-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A dynamic/unbounded alternative to Bounded Enum
--
-- Please see the README on GitHub at
-- https://github.com/cdornan/rg#readme
@package rg
@version 1.3.0.0
module Data.Rg
-- | 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)
class Rg rg
-- | the number of values in the enumeration; sizeRg sz > 0
sizeRg :: Rg rg => rg -> Int
-- | the nth item in the enumeration (first is 0)
toRg :: Rg rg => rg -> Int -> Maybe rg
-- | place in the enumation (first is 0)
fromRg :: Rg rg => rg -> Int
-- | an alternative way of specifying sizeRg, toRg and fromRg
rgCoreMethods :: Rg rg => RgCoreMethods rg
-- | first item in the enumeration
minRg :: Rg rg => rg -> rg
-- | last item in the enumeration
maxRg :: Rg rg => rg -> rg
-- | next item in the enumeration (Nothing if already last)
succRg :: Rg rg => rg -> Maybe rg
-- | previous item in the enumeration (Nothing if already first)
predRg :: Rg rg => rg -> Maybe rg
-- | list given items in the enumeration
allListRg :: Rg rg => rg -> [rg]
-- | list given items in the enumeration, stopping as soon as an index is
-- out of range
listRg :: Rg rg => rg -> [Int] -> [rg]
-- | list given items in the enumeration as a Vector
allVectorRg :: Rg rg => rg -> [rg]
-- | list the items in the enumeration as a Vector, stopping as soon
-- as an index is out of range
vectorRg :: Rg rg => rg -> [Int] -> Vector rg
-- | dynamically encapsulates the core Rg methods
data RgCoreMethods rg
-- | if you want to create an Rg from a Bounded Enum
-- you can bind rgCoreMethods to this function
rgCoreMethodsBE :: forall rg. (Bounded rg, Enum rg) => RgCoreMethods rg
-- | a class in which we can build things and parse them from Text
class (Rg e, Buildable e, Eq e, Ord e, Show e) => RgText e
parseRgText :: RgText e => e -> Text -> Possibly e
-- | a newtype wrapper used for deriving Rg instances from
-- Bounded Enum
newtype BE a
BE :: a -> BE a
[_BE] :: BE a -> a
-- | used to generate Rg values from lists of things
data Range a
-- | generating a Range from a list
newStartOfRangeFromList :: [a] -> Range a
-- | generating a Range from a Vector
newStartOfRangeFromVector :: Vector a -> Range a
-- | extracting the thing
extractRange :: Range a -> a
instance GHC.Show.Show a => GHC.Show.Show (Data.Rg.Range a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Rg.BE a)
instance GHC.Enum.Enum a => GHC.Enum.Enum (Data.Rg.BE a)
instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Data.Rg.BE a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Rg.BE a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Rg.BE a)
instance Data.Rg.Rg (Data.Rg.Range a)
instance (GHC.Enum.Bounded i, GHC.Enum.Enum i) => Data.Rg.Rg (Data.Rg.BE i)