| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Rg
Synopsis
- class Rg rg where
- data RgCoreMethods rg
- rgCoreMethodsBE :: forall rg. (Bounded rg, Enum rg) => RgCoreMethods rg
- class (Rg e, Buildable e, Eq e, Ord e, Show e) => RgText e where
- parseRgText :: e -> Text -> Possibly e
- newtype BE a = BE {
- _BE :: a
- data Range a
- newStartOfRangeFromList :: [a] -> Range a
- newStartOfRangeFromVector :: Vector a -> Range a
- extractRange :: Range a -> a
Documentation
Rg acts a bit like a Bounded Enum, but the size of the enumeration
can be dynamically determined from each value in the type (see sizeRg)
Minimal complete definition
Methods
the number of values in the enumeration; sizeRg sz > 0
toRg :: rg -> Int -> Maybe rg Source #
the nth item in the enumeration (first is 0)
place in the enumation (first is 0)
rgCoreMethods :: RgCoreMethods rg Source #
an alternative way of specifying sizeRg, toRg and fromRg
first item in the enumeration
last item in the enumeration
succRg :: rg -> Maybe rg Source #
next item in the enumeration (Nothing if already last)
predRg :: rg -> Maybe rg Source #
previous item in the enumeration (Nothing if already first)
allListRg :: rg -> [rg] Source #
list given items in the enumeration
listRg :: rg -> [Int] -> [rg] Source #
list given items in the enumeration, stopping as soon as an index is out of range
allVectorRg :: rg -> [rg] Source #
list given items in the enumeration as a Vector
vectorRg :: rg -> [Int] -> Vector rg Source #
list the items in the enumeration as a Vector, stopping as soon as an
index is out of range
Instances
| Rg (Range a) Source # | |
Defined in Data.Rg Methods sizeRg :: Range a -> Int Source # toRg :: Range a -> Int -> Maybe (Range a) Source # fromRg :: Range a -> Int Source # rgCoreMethods :: RgCoreMethods (Range a) Source # minRg :: Range a -> Range a Source # maxRg :: Range a -> Range a Source # succRg :: Range a -> Maybe (Range a) Source # predRg :: Range a -> Maybe (Range a) Source # allListRg :: Range a -> [Range a] Source # listRg :: Range a -> [Int] -> [Range a] Source # allVectorRg :: Range a -> [Range a] Source # | |
| (Bounded i, Enum i) => Rg (BE i) Source # | |
Defined in Data.Rg Methods sizeRg :: BE i -> Int Source # toRg :: BE i -> Int -> Maybe (BE i) Source # fromRg :: BE i -> Int Source # rgCoreMethods :: RgCoreMethods (BE i) Source # minRg :: BE i -> BE i Source # maxRg :: BE i -> BE i Source # succRg :: BE i -> Maybe (BE i) Source # predRg :: BE i -> Maybe (BE i) Source # allListRg :: BE i -> [BE i] Source # listRg :: BE i -> [Int] -> [BE i] Source # allVectorRg :: BE i -> [BE i] Source # | |
data RgCoreMethods rg Source #
dynamically encapsulates the core Rg methods
rgCoreMethodsBE :: forall rg. (Bounded rg, Enum rg) => RgCoreMethods rg Source #
if you want to create an Rg from a Bounded Enum you can bind
rgCoreMethods to this function
class (Rg e, Buildable e, Eq e, Ord e, Show e) => RgText e where Source #
a class in which we can build things and parse them from Text
Minimal complete definition
Nothing
Methods
parseRgText :: e -> Text -> Possibly e Source #
Instances
| Bounded a => Bounded (BE a) Source # | |
| Enum a => Enum (BE a) Source # | |
| Eq a => Eq (BE a) Source # | |
| Ord a => Ord (BE a) Source # | |
| Show a => Show (BE a) Source # | |
| (Bounded i, Enum i) => Rg (BE i) Source # | |
Defined in Data.Rg Methods sizeRg :: BE i -> Int Source # toRg :: BE i -> Int -> Maybe (BE i) Source # fromRg :: BE i -> Int Source # rgCoreMethods :: RgCoreMethods (BE i) Source # minRg :: BE i -> BE i Source # maxRg :: BE i -> BE i Source # succRg :: BE i -> Maybe (BE i) Source # predRg :: BE i -> Maybe (BE i) Source # allListRg :: BE i -> [BE i] Source # listRg :: BE i -> [Int] -> [BE i] Source # allVectorRg :: BE i -> [BE i] Source # | |
used to generate Rg values from lists of things
Instances
| Show a => Show (Range a) Source # | |
| Rg (Range a) Source # | |
Defined in Data.Rg Methods sizeRg :: Range a -> Int Source # toRg :: Range a -> Int -> Maybe (Range a) Source # fromRg :: Range a -> Int Source # rgCoreMethods :: RgCoreMethods (Range a) Source # minRg :: Range a -> Range a Source # maxRg :: Range a -> Range a Source # succRg :: Range a -> Maybe (Range a) Source # predRg :: Range a -> Maybe (Range a) Source # allListRg :: Range a -> [Range a] Source # listRg :: Range a -> [Int] -> [Range a] Source # allVectorRg :: Range a -> [Range a] Source # | |
newStartOfRangeFromList :: [a] -> Range a Source #
generating a Range from a list
extractRange :: Range a -> a Source #
extracting the thing