-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Alternative prelude with batteries and no dependencies
--   
--   A custom prelude with no dependencies apart from base.
--   
--   This package has the following goals:
--   
--   <ul>
--   <li>provide a base like sets of modules that provide a consistent set
--   of features and bugfixes across multiple versions of GHC (unlike
--   base).</li>
--   <li>provide a better and more efficient prelude than base's
--   prelude.</li>
--   <li>be self-sufficient: no external dependencies apart from base.</li>
--   <li>provide better data-types: packed unicode string by default,
--   arrays.</li>
--   <li>Better numerical classes that better represent mathematical thing
--   (No more all-in-one Num).</li>
--   <li>Better I/O system with less Lazy IO</li>
--   <li>Usual partial functions distinguished through type system</li>
--   </ul>
@package foundation
@version 0.0.30


-- | Give access to Array non public functions which can be used to make
--   certains optimisations.
--   
--   Most of what is available here has no guarantees of stability.
--   Anything can be removed and changed.
module Foundation.Array.Internal
data () => UArray ty
UArray :: {-# UNPACK #-} !Offset ty -> {-# UNPACK #-} !CountOf ty -> !UArrayBackend ty -> UArray ty
fromForeignPtr :: PrimType ty => (ForeignPtr ty, Int, Int) -> UArray ty
withPtr :: forall ty prim a. (PrimMonad prim, PrimType ty) => UArray ty -> (Ptr ty -> prim a) -> prim a
copyToPtr :: (PrimType ty, PrimMonad prim) => UArray ty -> Ptr ty -> prim ()
recast :: (PrimType a, PrimType b) => UArray a -> UArray b
toHexadecimal :: PrimType ty => UArray ty -> UArray Word8
new :: (PrimMonad prim, PrimType ty) => CountOf ty -> prim (MUArray ty (PrimState prim))
newPinned :: (PrimMonad prim, PrimType ty) => CountOf ty -> prim (MUArray ty (PrimState prim))
withMutablePtr :: (PrimMonad prim, PrimType ty) => MUArray ty (PrimState prim) -> (Ptr ty -> prim a) -> prim a


-- | Formally, the class <a>Bifunctor</a> represents a bifunctor from
--   <tt>Hask</tt> -&gt; <tt>Hask</tt>.
--   
--   Intuitively it is a bifunctor where both the first and second
--   arguments are covariant.
--   
--   You can define a <a>Bifunctor</a> by either defining <a>bimap</a> or
--   by defining both <a>first</a> and <a>second</a>.
module Foundation.Class.Bifunctor


module Foundation.Foreign
foreignMem :: PrimType ty => FinalPtr ty -> CountOf ty -> UArray ty
mutableForeignMem :: (PrimMonad prim, PrimType ty) => FinalPtr ty -> Int -> prim (MUArray ty (PrimState prim))


module Foundation.IO.Terminal

-- | Print a string with a newline to standard output
putStrLn :: String -> IO ()

-- | Print a string to standard output
putStr :: String -> IO ()
stdin :: Handle
stdout :: Handle

-- | Get the arguments from the terminal command
getArgs :: IO [String]
exitFailure :: IO a
exitSuccess :: IO a


-- | A Nat-sized list abstraction
--   
--   Using this module is limited to GHC 7.10 and above.
module Foundation.List.ListN

module Foundation.Math.Trigonometry

-- | Method to support basic trigonometric functions
class Trigonometry a

-- | the famous pi value
pi :: Trigonometry a => a

-- | sine
sin :: Trigonometry a => a -> a

-- | cosine
cos :: Trigonometry a => a -> a

-- | tan
tan :: Trigonometry a => a -> a

-- | sine-1
asin :: Trigonometry a => a -> a

-- | cosine-1
acos :: Trigonometry a => a -> a

-- | tangent-1
atan :: Trigonometry a => a -> a

-- | hyperbolic sine
sinh :: Trigonometry a => a -> a

-- | hyperbolic cosine
cosh :: Trigonometry a => a -> a

-- | hyperbolic tangent
tanh :: Trigonometry a => a -> a

-- | hyperbolic sine-1
asinh :: Trigonometry a => a -> a

-- | hyperbolic cosine-1
acosh :: Trigonometry a => a -> a

-- | hyperbolic tangent-1
atanh :: Trigonometry a => a -> a
instance Foundation.Math.Trigonometry.Trigonometry GHC.Types.Float
instance Foundation.Math.Trigonometry.Trigonometry GHC.Types.Double

module Foundation.Exception
finally :: MonadBracket m => m a -> m b -> m a
try :: (MonadCatch m, Exception e) => m a -> m (Either e a)
data () => SomeException

module Foundation.Monad.State
class Monad m => MonadState m where {
    type State m;
}
withState :: MonadState m => (State m -> (a, State m)) -> m a
get :: MonadState m => m (State m)
put :: MonadState m => State m -> m ()

-- | State Transformer
data StateT s m a
runStateT :: StateT s m a -> s -> m (a, s)
instance GHC.Base.Functor m => GHC.Base.Functor (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Applicative m, GHC.Base.Monad m) => GHC.Base.Applicative (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => GHC.Base.Monad (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, Control.Monad.Fix.MonadFix m) => Control.Monad.Fix.MonadFix (Foundation.Monad.State.StateT s m)
instance Foundation.Monad.Transformer.MonadTrans (Foundation.Monad.State.StateT s)
instance (GHC.Base.Functor m, Control.Monad.IO.Class.MonadIO m) => Control.Monad.IO.Class.MonadIO (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, Basement.Monad.MonadFailure m) => Basement.Monad.MonadFailure (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, Foundation.Monad.Exception.MonadThrow m) => Foundation.Monad.Exception.MonadThrow (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, Foundation.Monad.Exception.MonadCatch m) => Foundation.Monad.Exception.MonadCatch (Foundation.Monad.State.StateT s m)
instance (GHC.Base.Functor m, GHC.Base.Monad m) => Foundation.Monad.State.MonadState (Foundation.Monad.State.StateT s m)


-- | The Reader monad transformer.
--   
--   This is useful to keep a non-modifiable value in a context
module Foundation.Monad.Reader
class Monad m => MonadReader m where {
    type ReaderContext m;
}
ask :: MonadReader m => m (ReaderContext m)

-- | Reader Transformer
data ReaderT r m a
runReaderT :: ReaderT r m a -> r -> m a
instance GHC.Base.Functor m => GHC.Base.Functor (Foundation.Monad.Reader.ReaderT r m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (Foundation.Monad.Reader.ReaderT r m)
instance GHC.Base.Monad m => GHC.Base.Monad (Foundation.Monad.Reader.ReaderT r m)
instance (GHC.Base.Monad m, Control.Monad.Fix.MonadFix m) => Control.Monad.Fix.MonadFix (Foundation.Monad.Reader.ReaderT s m)
instance Foundation.Monad.Transformer.MonadTrans (Foundation.Monad.Reader.ReaderT r)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Foundation.Monad.Reader.ReaderT r m)
instance Basement.Monad.MonadFailure m => Basement.Monad.MonadFailure (Foundation.Monad.Reader.ReaderT r m)
instance Foundation.Monad.Exception.MonadThrow m => Foundation.Monad.Exception.MonadThrow (Foundation.Monad.Reader.ReaderT r m)
instance Foundation.Monad.Exception.MonadCatch m => Foundation.Monad.Exception.MonadCatch (Foundation.Monad.Reader.ReaderT r m)
instance Foundation.Monad.Exception.MonadBracket m => Foundation.Monad.Exception.MonadBracket (Foundation.Monad.Reader.ReaderT r m)
instance GHC.Base.Monad m => Foundation.Monad.Reader.MonadReader (Foundation.Monad.Reader.ReaderT r m)

module Foundation.Monad.Except
newtype ExceptT e m a
ExceptT :: m (Either e a) -> ExceptT e m a
[runExceptT] :: ExceptT e m a -> m (Either e a)
instance GHC.Base.Functor m => GHC.Base.Functor (Foundation.Monad.Except.ExceptT e m)
instance GHC.Base.Monad m => GHC.Base.Applicative (Foundation.Monad.Except.ExceptT e m)
instance GHC.Base.Monad m => Basement.Monad.MonadFailure (Foundation.Monad.Except.ExceptT e m)
instance GHC.Base.Monad m => GHC.Base.Monad (Foundation.Monad.Except.ExceptT e m)
instance Control.Monad.Fail.MonadFail m => Control.Monad.Fail.MonadFail (Foundation.Monad.Except.ExceptT e m)
instance (GHC.Base.Monad m, Control.Monad.Fix.MonadFix m) => Control.Monad.Fix.MonadFix (Foundation.Monad.Except.ExceptT e m)
instance Foundation.Monad.Reader.MonadReader m => Foundation.Monad.Reader.MonadReader (Foundation.Monad.Except.ExceptT e m)
instance Foundation.Monad.Transformer.MonadTrans (Foundation.Monad.Except.ExceptT e)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Foundation.Monad.Except.ExceptT e m)


-- | Compared to the Haskell hierarchy of number classes this provide a
--   more flexible approach that is closer to the mathematical foundation
--   (group, field, etc)
--   
--   This try to only provide one feature per class, at the expense of the
--   number of classes.
module Foundation.Numerical
class (Integral a, Eq a, Ord a) => IsIntegral a
toInteger :: IsIntegral a => a -> Integer
class IsIntegral a => IsNatural a
toNatural :: IsNatural a => a -> Natural

-- | types that have sign and can be made absolute
class Signed a
abs :: Signed a => a -> a
signum :: Signed a => a -> Sign
class () => Additive a
azero :: Additive a => a
(+) :: Additive a => a -> a -> a
scale :: (Additive a, IsNatural n) => n -> a -> a
class () => Subtractive a where {
    type family Difference a;
}
(-) :: Subtractive a => a -> a -> Difference a
class () => Multiplicative a
midentity :: Multiplicative a => a
(*) :: Multiplicative a => a -> a -> a
(^) :: (Multiplicative a, IsNatural n, Enum n, IDivisible n) => a -> n -> a
class (Additive a, Multiplicative a) => IDivisible a
div :: IDivisible a => a -> a -> a
mod :: IDivisible a => a -> a -> a
divMod :: IDivisible a => a -> a -> (a, a)
class Multiplicative a => Divisible a
(/) :: Divisible a => a -> a -> a

-- | Sign of a signed number
data Sign
SignNegative :: Sign
SignZero :: Sign
SignPositive :: Sign
recip :: Divisible a => a -> a
class IntegralRounding a

-- | Round up, to the next integral.
--   
--   Also known as <tt>ceiling</tt>
roundUp :: (IntegralRounding a, Integral n) => a -> n

-- | Round down, to the previous integral
--   
--   Also known as <tt>floor</tt>
roundDown :: (IntegralRounding a, Integral n) => a -> n

-- | Truncate to the closest integral to the fractional number closer to 0.
--   
--   This is equivalent to roundUp for negative Number and roundDown for
--   positive Number
roundTruncate :: (IntegralRounding a, Integral n) => a -> n

-- | Round to the nearest integral
--   
--   <pre>
--   roundNearest 3.6
--   </pre>
--   
--   4 &gt; roundNearest 3.4 3
roundNearest :: (IntegralRounding a, Integral n) => a -> n

-- | IEEE754 Floating Point
class FloatingPoint a
floatRadix :: FloatingPoint a => Proxy a -> Integer
floatDigits :: FloatingPoint a => Proxy a -> Int
floatRange :: FloatingPoint a => Proxy a -> (Int, Int)
floatDecode :: FloatingPoint a => a -> (Integer, Int)
floatEncode :: FloatingPoint a => Integer -> Int -> a
instance GHC.Classes.Eq Foundation.Numerical.Sign
instance Foundation.Numerical.IntegralRounding GHC.Real.Rational
instance Foundation.Numerical.IntegralRounding GHC.Types.Double
instance Foundation.Numerical.IntegralRounding GHC.Types.Float
instance Foundation.Numerical.Signed GHC.Num.Integer.Integer
instance Foundation.Numerical.Signed GHC.Types.Int
instance Foundation.Numerical.Signed GHC.Int.Int8
instance Foundation.Numerical.Signed GHC.Int.Int16
instance Foundation.Numerical.Signed GHC.Int.Int32
instance Foundation.Numerical.Signed GHC.Int.Int64
instance Foundation.Numerical.Signed GHC.Types.Float
instance Foundation.Numerical.Signed GHC.Types.Double

module Foundation.Monad
class Monad m => MonadIO (m :: Type -> Type)
liftIO :: MonadIO m => IO a -> m a
class Monad m => MonadFailure (m :: Type -> Type) where {
    type family Failure (m :: Type -> Type);
}
mFail :: MonadFailure m => Failure m -> m ()

-- | Monad that can throw exception
class Monad m => MonadThrow m

-- | Throw immediatity an exception. Only a <a>MonadCatch</a> monad will be
--   able to catch the exception using <a>catch</a>
throw :: (MonadThrow m, Exception e) => e -> m a

-- | Monad that can catch exception
class MonadThrow m => MonadCatch m
catch :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a

-- | Monad that can ensure cleanup actions are performed even in the case
--   of exceptions, both synchronous and asynchronous. This usually
--   excludes continuation-based monads.
class MonadCatch m => MonadBracket m

-- | A generalized version of the standard bracket function which allows
--   distinguishing different exit cases.
generalBracket :: MonadBracket m => m a -> (a -> b -> m ignored1) -> (a -> SomeException -> m ignored2) -> (a -> m b) -> m b

-- | Basic Transformer class
class MonadTrans trans

-- | Lift a computation from an inner monad to the current transformer
--   monad
lift :: (MonadTrans trans, Monad m) => m a -> trans m a
newtype () => Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a

-- | <tt><a>replicateM</a> n act</tt> performs the action <tt>n</tt> times,
--   gathering the results.
replicateM :: Applicative m => CountOf a -> m a -> m [a]


-- | Different collections (list, vector, string, ..) unified under 1 API.
--   an API to rules them all, and in the darkness bind them.
module Foundation.Collection
class Zippable col => BoxedZippable col

-- | <a>zip</a> takes two collections and returns a collections of
--   corresponding pairs. If one input collection is short, excess elements
--   of the longer collection are discarded.
zip :: (BoxedZippable col, Sequential a, Sequential b, Element col ~ (Element a, Element b)) => a -> b -> col

-- | Like <a>zip</a>, but works with 3 collections.
zip3 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Element col ~ (Element a, Element b, Element c)) => a -> b -> c -> col

-- | Like <a>zip</a>, but works with 4 collections.
zip4 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Element col ~ (Element a, Element b, Element c, Element d)) => a -> b -> c -> d -> col

-- | Like <a>zip</a>, but works with 5 collections.
zip5 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Element col ~ (Element a, Element b, Element c, Element d, Element e)) => a -> b -> c -> d -> e -> col

-- | Like <a>zip</a>, but works with 6 collections.
zip6 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f)) => a -> b -> c -> d -> e -> f -> col

-- | Like <a>zip</a>, but works with 7 collections.
zip7 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => a -> b -> c -> d -> e -> f -> g -> col

-- | <a>unzip</a> transforms a collection of pairs into a collection of
--   first components and a collection of second components.
unzip :: (BoxedZippable col, Sequential a, Sequential b, Element col ~ (Element a, Element b)) => col -> (a, b)

-- | Like <a>unzip</a>, but works on a collection of 3-element tuples.
unzip3 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Element col ~ (Element a, Element b, Element c)) => col -> (a, b, c)

-- | Like <a>unzip</a>, but works on a collection of 4-element tuples.
unzip4 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Element col ~ (Element a, Element b, Element c, Element d)) => col -> (a, b, c, d)

-- | Like <a>unzip</a>, but works on a collection of 5-element tuples.
unzip5 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Element col ~ (Element a, Element b, Element c, Element d, Element e)) => col -> (a, b, c, d, e)

-- | Like <a>unzip</a>, but works on a collection of 6-element tuples.
unzip6 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f)) => col -> (a, b, c, d, e, f)

-- | Like <a>unzip</a>, but works on a collection of 7-element tuples.
unzip7 :: (BoxedZippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => col -> (a, b, c, d, e, f, g)

-- | Element type of a collection
type family Element container

-- | A monomorphic functor that maps the inner values to values of the same
--   type
class InnerFunctor c
imap :: InnerFunctor c => (Element c -> Element c) -> c -> c
imap :: (InnerFunctor c, Functor f, Element (f a) ~ a, f a ~ c) => (Element c -> Element c) -> c -> c

-- | Give the ability to fold a collection on itself
class Foldable collection

-- | Left-associative fold of a structure.
--   
--   In the case of lists, foldl, when applied to a binary operator, a
--   starting value (typically the left-identity of the operator), and a
--   list, reduces the list using the binary operator, from left to right:
--   
--   <pre>
--   foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
--   </pre>
--   
--   Note that to produce the outermost application of the operator the
--   entire input list must be traversed. This means that foldl' will
--   diverge if given an infinite list.
--   
--   Note that Foundation only provides <a>foldl'</a>, a strict version of
--   <tt>foldl</tt> because the lazy version is seldom useful.
--   
--   Left-associative fold of a structure with strict application of the
--   operator.
foldl' :: Foldable collection => (a -> Element collection -> a) -> a -> collection -> a

-- | Right-associative fold of a structure.
--   
--   <pre>
--   foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
--   </pre>
foldr :: Foldable collection => (Element collection -> a -> a) -> a -> collection -> a

-- | Right-associative fold of a structure, but with strict application of
--   the operator.
foldr' :: Foldable collection => (Element collection -> a -> a) -> a -> collection -> a

-- | Fold1's. Like folds, but they assume to operate on a NonEmpty
--   collection.
class Foldable f => Fold1able f

-- | Left associative strict fold.
foldl1' :: Fold1able f => (Element f -> Element f -> Element f) -> NonEmpty f -> Element f

-- | Right associative lazy fold.
foldr1 :: Fold1able f => (Element f -> Element f -> Element f) -> NonEmpty f -> Element f

-- | Functors representing data structures that can be traversed from left
--   to right.
--   
--   Mostly like base's <tt>Traversable</tt> but applied to collections
--   only.
class Functor collection => Mappable collection

-- | Map each element of a structure to an action, evaluate these actions
--   from left to right, and collect the results. For a version that
--   ignores the results see <a>traverse_</a>.
traverse :: (Mappable collection, Applicative f) => (a -> f b) -> collection a -> f (collection b)

-- | Evaluate each actions of the given collections, from left to right,
--   and collect the results. For a version that ignores the results, see
--   <a>sequenceA_</a>
sequenceA :: (Mappable collection, Applicative f) => collection (f a) -> f (collection a)

-- | Map each element of the collection to an action, evaluate these
--   actions from left to right, and collect the results. For a version
--   that ignores the results see <a>mapM_</a>.
mapM :: (Mappable collection, Applicative m, Monad m) => (a -> m b) -> collection a -> m (collection b)

-- | Evaluate each actions of the given collections, from left to right,
--   and collect the results. For a version that ignores the results, see
--   <a>sequence_</a>
sequence :: (Mappable collection, Applicative m, Monad m) => collection (m a) -> m (collection a)

-- | Map each element of a collection to an action, evaluate these actions
--   from left to right, and ignore the results. For a version that doesn't
--   ignore the results see <a>traverse</a>
traverse_ :: (Mappable col, Applicative f) => (a -> f b) -> col a -> f ()

-- | Evaluate each action in the collection from left to right, and ignore
--   the results. For a version that doesn't ignore the results see
--   <a>sequenceA</a>. sequenceA_ :: (Mappable col, Applicative f) =&gt;
--   col (f a) -&gt; f () sequenceA_ col = sequenceA col *&gt; pure ()
--   
--   Map each element of a collection to a monadic action, evaluate these
--   actions from left to right, and ignore the results. For a version that
--   doesn't ignore the results see <a>mapM</a>.
mapM_ :: (Mappable col, Applicative m, Monad m) => (a -> m b) -> col a -> m ()

-- | <a>forM</a> is <a>mapM</a> with its arguments flipped. For a version
--   that ignores the results see <a>forM_</a>.
forM :: (Mappable col, Applicative m, Monad m) => col a -> (a -> m b) -> m (col b)

-- | <a>forM_</a> is <a>mapM_</a> with its arguments flipped. For a version
--   that doesn't ignore the results see <a>forM</a>.
forM_ :: (Mappable col, Applicative m, Monad m) => col a -> (a -> m b) -> m ()

-- | A set of methods for ordered colection
class (IsList c, Item c ~ Element c) => Collection c

-- | Check if a collection is empty
null :: Collection c => c -> Bool

-- | Length of a collection (number of Element c)
length :: Collection c => c -> CountOf (Element c)

-- | Check if a collection contains a specific element
--   
--   This is the inverse of <a>notElem</a>.
elem :: forall a. (Collection c, Eq a, a ~ Element c) => Element c -> c -> Bool

-- | Check if a collection does *not* contain a specific element
--   
--   This is the inverse of <a>elem</a>.
notElem :: forall a. (Collection c, Eq a, a ~ Element c) => Element c -> c -> Bool

-- | Get the maximum element of a collection
maximum :: forall a. (Collection c, Ord a, a ~ Element c) => NonEmpty c -> Element c

-- | Get the minimum element of a collection
minimum :: forall a. (Collection c, Ord a, a ~ Element c) => NonEmpty c -> Element c

-- | Determine is any elements of the collection satisfy the predicate
any :: Collection c => (Element c -> Bool) -> c -> Bool

-- | Determine is all elements of the collection satisfy the predicate
all :: Collection c => (Element c -> Bool) -> c -> Bool

-- | Return True if all the elements in the collection are True
and :: (Collection col, Element col ~ Bool) => col -> Bool

-- | Return True if at least one element in the collection is True
or :: (Collection col, Element col ~ Bool) => col -> Bool
data () => NonEmpty a
getNonEmpty :: NonEmpty a -> a

-- | Smart constructor to create a NonEmpty collection
--   
--   If the collection is empty, then Nothing is returned Otherwise, the
--   collection is wrapped in the NonEmpty property
nonEmpty :: Collection c => c -> Maybe (NonEmpty c)

-- | same as <a>nonEmpty</a>, but assume that the collection is non empty,
--   and return an asynchronous error if it is.
nonEmpty_ :: Collection c => c -> NonEmpty c
nonEmptyFmap :: Functor f => (a -> b) -> NonEmpty (f a) -> NonEmpty (f b)

-- | A set of methods for ordered colection
class (IsList c, Item c ~ Element c, Monoid c, Collection c) => Sequential c

-- | Take the first @n elements of a collection
take :: Sequential c => CountOf (Element c) -> c -> c

-- | Take the last @n elements of a collection
revTake :: Sequential c => CountOf (Element c) -> c -> c

-- | Drop the first @n elements of a collection
drop :: Sequential c => CountOf (Element c) -> c -> c

-- | Drop the last @n elements of a collection
revDrop :: Sequential c => CountOf (Element c) -> c -> c

-- | Split the collection at the @n'th elements
splitAt :: Sequential c => CountOf (Element c) -> c -> (c, c)

-- | Split the collection at the @n'th elements from the end
revSplitAt :: Sequential c => CountOf (Element c) -> c -> (c, c)

-- | Split on a specific elements returning a list of colletion
splitOn :: Sequential c => (Element c -> Bool) -> c -> [c]

-- | Split a collection when the predicate return true
break :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection when the predicate return true starting from the
--   end of the collection
breakEnd :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection at the given element
breakElem :: (Sequential c, Eq (Element c)) => Element c -> c -> (c, c)

-- | Return the longest prefix in the collection that satisfy the predicate
takeWhile :: Sequential c => (Element c -> Bool) -> c -> c

-- | Return the longest prefix in the collection that satisfy the predicate
dropWhile :: Sequential c => (Element c -> Bool) -> c -> c

-- | The <a>intersperse</a> function takes an element and a list and
--   `intersperses' that element between the elements of the list. For
--   example,
--   
--   <pre>
--   intersperse ',' "abcde" == "a,b,c,d,e"
--   </pre>
intersperse :: Sequential c => Element c -> c -> c

-- | <a>intercalate</a> <tt>xs xss</tt> is equivalent to
--   <tt>(<a>mconcat</a> (<a>intersperse</a> xs xss))</tt>. It inserts the
--   list <tt>xs</tt> in between the lists in <tt>xss</tt> and concatenates
--   the result.
intercalate :: (Sequential c, Monoid (Item c)) => Element c -> c -> Element c

-- | Split a collection while the predicate return true
span :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection while the predicate return true starting from the
--   end of the collection
spanEnd :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Filter all the elements that satisfy the predicate
filter :: Sequential c => (Element c -> Bool) -> c -> c

-- | Partition the elements that satisfy the predicate and those that don't
partition :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Reverse a collection
reverse :: Sequential c => c -> c

-- | Decompose a collection into its first element and the remaining
--   collection. If the collection is empty, returns Nothing.
uncons :: Sequential c => c -> Maybe (Element c, c)

-- | Decompose a collection into a collection without its last element, and
--   the last element If the collection is empty, returns Nothing.
unsnoc :: Sequential c => c -> Maybe (c, Element c)

-- | Prepend an element to an ordered collection
snoc :: Sequential c => c -> Element c -> c

-- | Append an element to an ordered collection
cons :: Sequential c => Element c -> c -> c

-- | Find an element in an ordered collection
find :: Sequential c => (Element c -> Bool) -> c -> Maybe (Element c)

-- | Sort an ordered collection using the specified order function
sortBy :: Sequential c => (Element c -> Element c -> Ordering) -> c -> c

-- | Create a collection with a single element
singleton :: Sequential c => Element c -> c

-- | get the first element of a non-empty collection
head :: Sequential c => NonEmpty c -> Element c

-- | get the last element of a non-empty collection
last :: Sequential c => NonEmpty c -> Element c

-- | Extract the elements after the first element of a non-empty
--   collection.
tail :: Sequential c => NonEmpty c -> c

-- | Extract the elements before the last element of a non-empty
--   collection.
init :: Sequential c => NonEmpty c -> c

-- | Create a collection where the element in parameter is repeated N time
replicate :: Sequential c => CountOf (Element c) -> Element c -> c

-- | Takes two collections and returns True iff the first collection is a
--   prefix of the second.
isPrefixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   prefix of the second.
isPrefixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   suffix of the second.
isSuffixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   suffix of the second.
isSuffixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is an
--   infix of the second.
isInfixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is an
--   infix of the second.
isInfixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Try to strip a prefix from a collection
stripPrefix :: (Sequential c, Eq (Element c)) => c -> c -> Maybe c

-- | Try to strip a suffix from a collection
stripSuffix :: (Sequential c, Eq (Element c)) => c -> c -> Maybe c

-- | Collection of things that can be made mutable, modified and then
--   freezed into an MutableFreezed collection
class MutableCollection c where {
    type MutableFreezed c;
    type MutableKey c;
    type MutableValue c;
}
unsafeThaw :: (MutableCollection c, PrimMonad prim) => MutableFreezed c -> prim (c (PrimState prim))
unsafeFreeze :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> prim (MutableFreezed c)
thaw :: (MutableCollection c, PrimMonad prim) => MutableFreezed c -> prim (c (PrimState prim))
freeze :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> prim (MutableFreezed c)
mutNew :: (MutableCollection c, PrimMonad prim) => CountOf (MutableValue c) -> prim (c (PrimState prim))
mutUnsafeWrite :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> MutableKey c -> MutableValue c -> prim ()
mutWrite :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> MutableKey c -> MutableValue c -> prim ()
mutUnsafeRead :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> MutableKey c -> prim (MutableValue c)
mutRead :: (MutableCollection c, PrimMonad prim) => c (PrimState prim) -> MutableKey c -> prim (MutableValue c)

-- | Collection of elements that can indexed by int
class IndexedCollection c
(!) :: IndexedCollection c => c -> Offset (Element c) -> Maybe (Element c)
findIndex :: IndexedCollection c => (Element c -> Bool) -> c -> Maybe (Offset (Element c))

-- | Collection of things that can be looked up by Key
class KeyedCollection c where {
    type Key c;
    type Value c;
}
lookup :: KeyedCollection c => Key c -> c -> Maybe (Value c)
class Sequential col => Zippable col

-- | <a>zipWith</a> generalises <a>zip</a> by zipping with the function
--   given as the first argument, instead of a tupling function. For
--   example, <tt><a>zipWith</a> (+)</tt> is applied to two collections to
--   produce the collection of corresponding sums.
zipWith :: (Zippable col, Sequential a, Sequential b) => (Element a -> Element b -> Element col) -> a -> b -> col

-- | Like <a>zipWith</a>, but works with 3 collections.
zipWith3 :: (Zippable col, Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element col) -> a -> b -> c -> col

-- | Like <a>zipWith</a>, but works with 4 collections.
zipWith4 :: (Zippable col, Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element col) -> a -> b -> c -> d -> col

-- | Like <a>zipWith</a>, but works with 5 collections.
zipWith5 :: (Zippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element col) -> a -> b -> c -> d -> e -> col

-- | Like <a>zipWith</a>, but works with 6 collections.
zipWith6 :: (Zippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element col) -> a -> b -> c -> d -> e -> f -> col

-- | Like <a>zipWith</a>, but works with 7 collections.
zipWith7 :: (Zippable col, Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element col) -> a -> b -> c -> d -> e -> f -> g -> col

-- | Collections that can be built chunk by chunk.
--   
--   Use the <a>Monad</a> instance of <a>Builder</a> to chain <a>append</a>
--   operations and feed it into <a>build</a>:
--   
--   <pre>
--   &gt;&gt;&gt; runST $ build 32 (append 'a' &gt;&gt; append 'b' &gt;&gt; append 'c') :: UArray Char
--   "abc"
--   </pre>
class Buildable col where {
    
    -- | Mutable collection type used for incrementally writing chunks.
    type Mutable col :: Type -> Type;
    
    -- | Unit of the smallest step possible in an <a>append</a> operation.
    --   
    --   A UTF-8 character can have a size between 1 and 4 bytes, so this
    --   should be defined as 1 byte for collections of <a>Char</a>.
    type Step col;
}
append :: (Buildable col, PrimMonad prim) => Element col -> Builder col (Mutable col) (Step col) prim err ()
build :: (Buildable col, PrimMonad prim) => Int -> Builder col (Mutable col) (Step col) prim err () -> prim (Either err col)
build_ :: (Buildable c, PrimMonad prim) => Int -> Builder c (Mutable c) (Step c) prim () () -> prim c
newtype () => Builder collection (mutCollection :: Type -> Type) step (state :: Type -> Type) err a
Builder :: State (Offset step, BuildingState collection mutCollection step (PrimState state), Maybe err) state a -> Builder collection (mutCollection :: Type -> Type) step (state :: Type -> Type) err a
[runBuilder] :: Builder collection (mutCollection :: Type -> Type) step (state :: Type -> Type) err a -> State (Offset step, BuildingState collection mutCollection step (PrimState state), Maybe err) state a
data () => BuildingState collection (mutCollection :: Type -> Type) step state
BuildingState :: [collection] -> !CountOf step -> mutCollection state -> !CountOf step -> BuildingState collection (mutCollection :: Type -> Type) step state
[prevChunks] :: BuildingState collection (mutCollection :: Type -> Type) step state -> [collection]
[prevChunksSize] :: BuildingState collection (mutCollection :: Type -> Type) step state -> !CountOf step
[curChunk] :: BuildingState collection (mutCollection :: Type -> Type) step state -> mutCollection state
[chunkSize] :: BuildingState collection (mutCollection :: Type -> Type) step state -> !CountOf step
class Copy a
copy :: Copy a => a -> a


-- | Data structure for optimised operations (append, cons, snoc) on list
module Foundation.List.DList
data DList a
instance GHC.Classes.Eq a => GHC.Classes.Eq (Foundation.List.DList.DList a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Foundation.List.DList.DList a)
instance GHC.Show.Show a => GHC.Show.Show (Foundation.List.DList.DList a)
instance GHC.IsList.IsList (Foundation.List.DList.DList a)
instance GHC.Base.Semigroup (Foundation.List.DList.DList a)
instance GHC.Base.Monoid (Foundation.List.DList.DList a)
instance GHC.Base.Functor Foundation.List.DList.DList
instance GHC.Base.Applicative Foundation.List.DList.DList
instance GHC.Base.Monad Foundation.List.DList.DList
instance Foundation.Collection.Foldable.Foldable (Foundation.List.DList.DList a)
instance Foundation.Collection.Collection.Collection (Foundation.List.DList.DList a)
instance Foundation.Collection.Sequential.Sequential (Foundation.List.DList.DList a)

module Foundation.Conduit.Textual

-- | Split conduit of string to its lines
--   
--   This is very similar to Prelude lines except it work directly on
--   Conduit
--   
--   Note that if the newline character is not ever appearing in the
--   stream, this function will keep accumulating data until OOM
--   
--   TODO: make a size-limited function
lines :: Monad m => Conduit String String m ()
words :: Monad m => Conduit String String m ()
fromBytes :: MonadThrow m => Encoding -> Conduit (UArray Word8) String m ()
toBytes :: Monad m => Encoding -> Conduit String (UArray Word8) m ()


-- | <a>https://github.com/haskell-foundation/issues/111</a>
module Foundation.Class.Storable

-- | Storable type of self determined size.
class Storable a
peek :: Storable a => Ptr a -> IO a
poke :: Storable a => Ptr a -> a -> IO ()

-- | Extending the Storable type class to the types that can be sequenced
--   in a structure.
class Storable a => StorableFixed a
size :: StorableFixed a => proxy a -> CountOf Word8
alignment :: StorableFixed a => proxy a -> CountOf Word8
data () => Ptr a
plusPtr :: StorableFixed a => Ptr a -> CountOf a -> Ptr a
castPtr :: Ptr a -> Ptr b

-- | like <a>peek</a> but at a given offset.
peekOff :: StorableFixed a => Ptr a -> Offset a -> IO a

-- | like <a>poke</a> but at a given offset.
pokeOff :: StorableFixed a => Ptr a -> Offset a -> a -> IO ()
peekArray :: (Buildable col, StorableFixed (Element col)) => CountOf (Element col) -> Ptr (Element col) -> IO col
peekArrayEndedBy :: (Buildable col, StorableFixed (Element col), Eq (Element col), Show (Element col)) => Element col -> Ptr (Element col) -> IO col
pokeArray :: (Sequential col, StorableFixed (Element col)) => Ptr (Element col) -> col -> IO ()
pokeArrayEndedBy :: (Sequential col, StorableFixed (Element col)) => Element col -> Ptr (Element col) -> col -> IO ()
instance Foundation.Class.Storable.StorableFixed Foreign.C.Types.CChar
instance Foundation.Class.Storable.StorableFixed Foreign.C.Types.CUChar
instance Foundation.Class.Storable.StorableFixed GHC.Types.Char
instance Foundation.Class.Storable.StorableFixed GHC.Types.Double
instance Foundation.Class.Storable.StorableFixed GHC.Types.Float
instance Foundation.Class.Storable.StorableFixed GHC.Int.Int8
instance Foundation.Class.Storable.StorableFixed GHC.Int.Int16
instance Foundation.Class.Storable.StorableFixed GHC.Int.Int32
instance Foundation.Class.Storable.StorableFixed GHC.Int.Int64
instance Foundation.Class.Storable.StorableFixed GHC.Word.Word8
instance Foundation.Class.Storable.StorableFixed GHC.Word.Word16
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.BE GHC.Word.Word16)
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.LE GHC.Word.Word16)
instance Foundation.Class.Storable.StorableFixed GHC.Word.Word32
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.BE GHC.Word.Word32)
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.LE GHC.Word.Word32)
instance Foundation.Class.Storable.StorableFixed GHC.Word.Word64
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.BE GHC.Word.Word64)
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.LE GHC.Word.Word64)
instance Foundation.Class.Storable.StorableFixed Basement.Types.Word128.Word128
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.BE Basement.Types.Word128.Word128)
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.LE Basement.Types.Word128.Word128)
instance Foundation.Class.Storable.StorableFixed Basement.Types.Word256.Word256
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.BE Basement.Types.Word256.Word256)
instance Foundation.Class.Storable.StorableFixed (Basement.Endianness.LE Basement.Types.Word256.Word256)
instance Foundation.Class.Storable.StorableFixed (GHC.Ptr.Ptr a)
instance Foundation.Class.Storable.Storable Foreign.C.Types.CChar
instance Foundation.Class.Storable.Storable Foreign.C.Types.CUChar
instance Foundation.Class.Storable.Storable GHC.Types.Char
instance Foundation.Class.Storable.Storable GHC.Types.Double
instance Foundation.Class.Storable.Storable GHC.Types.Float
instance Foundation.Class.Storable.Storable GHC.Int.Int8
instance Foundation.Class.Storable.Storable GHC.Int.Int16
instance Foundation.Class.Storable.Storable GHC.Int.Int32
instance Foundation.Class.Storable.Storable GHC.Int.Int64
instance Foundation.Class.Storable.Storable GHC.Word.Word8
instance Foundation.Class.Storable.Storable GHC.Word.Word16
instance Foundation.Class.Storable.Storable (Basement.Endianness.BE GHC.Word.Word16)
instance Foundation.Class.Storable.Storable (Basement.Endianness.LE GHC.Word.Word16)
instance Foundation.Class.Storable.Storable GHC.Word.Word32
instance Foundation.Class.Storable.Storable (Basement.Endianness.BE GHC.Word.Word32)
instance Foundation.Class.Storable.Storable (Basement.Endianness.LE GHC.Word.Word32)
instance Foundation.Class.Storable.Storable GHC.Word.Word64
instance Foundation.Class.Storable.Storable (Basement.Endianness.BE GHC.Word.Word64)
instance Foundation.Class.Storable.Storable (Basement.Endianness.LE GHC.Word.Word64)
instance Foundation.Class.Storable.Storable Basement.Types.Word128.Word128
instance Foundation.Class.Storable.Storable (Basement.Endianness.BE Basement.Types.Word128.Word128)
instance Foundation.Class.Storable.Storable (Basement.Endianness.LE Basement.Types.Word128.Word128)
instance Foundation.Class.Storable.Storable Basement.Types.Word256.Word256
instance Foundation.Class.Storable.Storable (Basement.Endianness.BE Basement.Types.Word256.Word256)
instance Foundation.Class.Storable.Storable (Basement.Endianness.LE Basement.Types.Word256.Word256)
instance Foundation.Class.Storable.Storable (GHC.Ptr.Ptr a)

module Foundation.Bits

-- | Unsafe Shift Left Operator
(.<<.) :: Bits a => a -> Int -> a

-- | Unsafe Shift Right Operator
(.>>.) :: Bits a => a -> Int -> a
class Eq a => Bits a
(.&.) :: Bits a => a -> a -> a
(.|.) :: Bits a => a -> a -> a
xor :: Bits a => a -> a -> a
complement :: Bits a => a -> a
shift :: Bits a => a -> Int -> a
rotate :: Bits a => a -> Int -> a
zeroBits :: Bits a => a
bit :: Bits a => Int -> a
setBit :: Bits a => a -> Int -> a
clearBit :: Bits a => a -> Int -> a
complementBit :: Bits a => a -> Int -> a
testBit :: Bits a => a -> Int -> Bool
bitSizeMaybe :: Bits a => a -> Maybe Int
bitSize :: Bits a => a -> Int
isSigned :: Bits a => a -> Bool
shiftL :: Bits a => a -> Int -> a
unsafeShiftL :: Bits a => a -> Int -> a
shiftR :: Bits a => a -> Int -> a
unsafeShiftR :: Bits a => a -> Int -> a
rotateL :: Bits a => a -> Int -> a
rotateR :: Bits a => a -> Int -> a
popCount :: Bits a => a -> Int

-- | Round up (if needed) to a multiple of <tt>alignment</tt> closst to
--   <tt>m</tt>
--   
--   <tt>alignment</tt> needs to be a power of two
--   
--   alignRoundUp 16 8 = 16 alignRoundUp 15 8 = 16
alignRoundUp :: Int -> Int -> Int

-- | Round down (if needed) to a multiple of <tt>alignment</tt> closest to
--   <tt>m</tt>
--   
--   <tt>alignment</tt> needs to be a power of two
--   
--   <pre>
--   alignRoundDown 15 8 = 8
--   alignRoundDown 8 8  = 8
--   </pre>
alignRoundDown :: Int -> Int -> Int


module Foundation.Primitive
class Eq ty => PrimType ty where {
    type family PrimSize ty :: Nat;
}
primSizeInBytes :: PrimType ty => Proxy ty -> CountOf Word8
primShiftToBytes :: PrimType ty => Proxy ty -> Int
primBaUIndex :: PrimType ty => ByteArray# -> Offset ty -> ty
primMbaURead :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> prim ty
primMbaUWrite :: (PrimType ty, PrimMonad prim) => MutableByteArray# (PrimState prim) -> Offset ty -> ty -> prim ()
primAddrIndex :: PrimType ty => Addr# -> Offset ty -> ty
primAddrRead :: (PrimType ty, PrimMonad prim) => Addr# -> Offset ty -> prim ty
primAddrWrite :: (PrimType ty, PrimMonad prim) => Addr# -> Offset ty -> ty -> prim ()
class (Functor m, Applicative m, Monad m) => PrimMonad (m :: Type -> Type) where {
    type family PrimState (m :: Type -> Type);
    type family PrimVar (m :: Type -> Type) :: Type -> Type;
}
primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
primThrow :: (PrimMonad m, Exception e) => e -> m a
unPrimMonad :: PrimMonad m => m a -> State# (PrimState m) -> (# State# (PrimState m), a #)
primVarNew :: PrimMonad m => a -> m (PrimVar m a)
primVarRead :: PrimMonad m => PrimVar m a -> m a
primVarWrite :: PrimMonad m => PrimVar m a -> a -> m ()
class () => ByteSwap a
newtype () => LE a
LE :: a -> LE a
[unLE] :: LE a -> a
toLE :: ByteSwap a => a -> LE a
fromLE :: ByteSwap a => LE a -> a
newtype () => BE a
BE :: a -> BE a
[unBE] :: BE a -> a
toBE :: ByteSwap a => a -> BE a
fromBE :: ByteSwap a => BE a -> a
class () => IntegralUpsize a b
integralUpsize :: IntegralUpsize a b => a -> b
class () => IntegralDownsize a b
integralDownsize :: IntegralDownsize a b => a -> b
integralDownsizeCheck :: IntegralDownsize a b => a -> Maybe b
class () => NormalForm a
toNormalForm :: NormalForm a => a -> ()
force :: NormalForm a => a -> a
deepseq :: NormalForm a => a -> b -> b
data () => These a b
This :: a -> These a b
That :: b -> These a b
These :: a -> b -> These a b
data () => Block ty
data () => MutableBlock ty st
data () => Char7
data () => AsciiString


-- | Simple Array and Almost-Array-like data structure
--   
--   Generally accessible in o(1)
module Foundation.Array
data () => Array a
data () => MArray a st
data () => UArray ty
data () => MUArray ty st
data ChunkedUArray ty
data Bitmap
data MutableBitmap st
class Eq ty => PrimType ty
data () => OutOfBound


-- | Enforce strictness when executing lambda
module Foundation.Strict
strict1 :: (a -> b) -> a -> b
strict2 :: (a -> b -> c) -> a -> b -> c
strict3 :: (a -> b -> c -> d) -> a -> b -> c -> d
strict4 :: (a -> b -> c -> d -> e) -> a -> b -> c -> d -> e
strict5 :: (a -> b -> c -> d -> e -> f) -> a -> b -> c -> d -> e -> f
strict6 :: (a -> b -> c -> d -> e -> f -> g) -> a -> b -> c -> d -> e -> f -> g


-- | Opaque packed String encoded in UTF8.
--   
--   The type is an instance of IsString and IsList, which allow
--   OverloadedStrings for string literal, and <tt>fromList</tt> to convert
--   a [Char] (Prelude String) to a packed representation
--   
--   <pre>
--   {-# LANGUAGE OverloadedStrings #-}
--   s = "Hello World" :: String
--   </pre>
--   
--   <pre>
--   s = fromList ("Hello World" :: Prelude.String) :: String
--   </pre>
--   
--   Each unicode code point is represented by a variable encoding of 1 to
--   4 bytes,
--   
--   For more information about UTF8:
--   <a>https://en.wikipedia.org/wiki/UTF-8</a>
module Foundation.String
data () => String
data () => Encoding
ASCII7 :: Encoding
UTF8 :: Encoding
UTF16 :: Encoding
UTF32 :: Encoding
ISO_8859_1 :: Encoding
fromBytes :: Encoding -> UArray Word8 -> (String, Maybe ValidationFailure, UArray Word8)
fromBytesLenient :: UArray Word8 -> (String, UArray Word8)
fromBytesUnsafe :: UArray Word8 -> String
toBytes :: Encoding -> String -> UArray Word8
data () => ValidationFailure
InvalidHeader :: ValidationFailure
InvalidContinuation :: ValidationFailure
MissingByte :: ValidationFailure
BuildingFailure :: ValidationFailure
lines :: String -> [String]
words :: String -> [String]
upper :: String -> String
lower :: String -> String
replace :: String -> String -> String -> String
indices :: String -> String -> [Offset8]
toBase64 :: String -> String
toBase64URL :: Bool -> String -> String
toBase64OpenBSD :: String -> String
breakLine :: String -> Either Bool (String, String)


-- | The current implementation is mainly, if not copy/pasted, inspired
--   from <tt>memory</tt>'s Parser.
--   
--   Foundation Parser makes use of the Foundation's <tt>Collection</tt>
--   and <tt>Sequential</tt> classes to allow you to define generic parsers
--   over any <tt>Sequential</tt> of inpu.
--   
--   This way you can easily implements parsers over <tt>LString</tt>,
--   <tt>String</tt>.
--   
--   <pre>
--   flip parseOnly "my.email@address.com" $ do
--      EmailAddress
--        &lt;$&gt; (takeWhile ((/=) '@' &lt;*  element '@')
--        &lt;*&gt; takeAll
--   </pre>
module Foundation.Parser

-- | Foundation's <tt>Parser</tt> monad.
--   
--   Its implementation is based on the parser in <tt>memory</tt>.
data Parser input result

-- | Run a Parser on a ByteString and return a <a>Result</a>
parse :: ParserSource input => Parser input a -> input -> Result input a

-- | Run a parser on an @initial input.
--   
--   If the Parser need more data than available, the @feeder function is
--   automatically called and fed to the More continuation.
parseFeed :: (ParserSource input, Monad m) => m (Chunk input) -> Parser input a -> input -> m (Result input a)

-- | parse only the given input
--   
--   The left-over `Element input` will be ignored, if the parser call for
--   more data it will be continuously fed with <a>Nothing</a> (up to 256
--   iterations).
parseOnly :: (ParserSource input, Monoid (Chunk input)) => Parser input a -> input -> Either (ParseError input) a

-- | result of executing the <tt>parser</tt> over the given <tt>input</tt>
data Result input result

-- | the parser failed with the given <tt>ParserError</tt>
ParseFailed :: ParseError input -> Result input result

-- | the parser complete successfuly with the remaining <tt>Chunk</tt>
ParseOk :: Chunk input -> result -> Result input result

-- | the parser needs more input, pass an empty <tt>Chunk</tt> or
--   <tt>mempty</tt> to tell the parser you don't have anymore inputs.
ParseMore :: (Chunk input -> Result input result) -> Result input result

-- | common parser error definition
data ParseError input

-- | meaning the parser was short of <tt>CountOf</tt> <tt>Element</tt> of
--   <tt>input</tt>.
NotEnough :: CountOf (Element input) -> ParseError input

-- | The parser needed more data, only when using <tt>parseOnly</tt>
NotEnoughParseOnly :: ParseError input

-- | when using <tt>element</tt>
ExpectedElement :: Element input -> Element input -> ParseError input

-- | when using <tt>elements</tt> or <tt>string</tt>
Expected :: Chunk input -> Chunk input -> ParseError input

-- | the <tt>satisfy</tt> or <tt>satisfy_</tt> function failed,
Satisfy :: Maybe String -> ParseError input

-- | helper function to report error when writing parsers
--   
--   This way we can provide more detailed error when building custom
--   parsers and still avoid to use the naughty _fail_.
--   
--   <pre>
--   myParser :: Parser input Int
--   myParser = reportError $ Satisfy (Just "this function is not implemented...")
--   </pre>
reportError :: ParseError input -> Parser input a
class (Sequential input, IndexedCollection input) => ParserSource input where {
    type Chunk input;
}
nullChunk :: ParserSource input => input -> Chunk input -> Bool
appendChunk :: ParserSource input => input -> Chunk input -> input
subChunk :: ParserSource input => input -> Offset (Element input) -> CountOf (Element input) -> Chunk input
spanChunk :: ParserSource input => input -> Offset (Element input) -> (Element input -> Bool) -> (Chunk input, Offset (Element input))

-- | peek the first element from the input source without consuming it
--   
--   Returns <a>Nothing</a> if there is no more input to parse.
peek :: ParserSource input => Parser input (Maybe (Element input))
element :: (ParserSource input, Eq (Element input), Element input ~ Element (Chunk input)) => Element input -> Parser input ()

-- | Get the next `Element input` from the parser
anyElement :: ParserSource input => Parser input (Element input)
elements :: (ParserSource input, Sequential (Chunk input), Element (Chunk input) ~ Element input, Eq (Chunk input)) => Chunk input -> Parser input ()
string :: String -> Parser String ()

-- | take one element if satisfy the given predicate
satisfy :: ParserSource input => Maybe String -> (Element input -> Bool) -> Parser input (Element input)

-- | take one element if satisfy the given predicate
satisfy_ :: ParserSource input => (Element input -> Bool) -> Parser input (Element input)
take :: (ParserSource input, Sequential (Chunk input), Element input ~ Element (Chunk input)) => CountOf (Element (Chunk input)) -> Parser input (Chunk input)
takeWhile :: (ParserSource input, Sequential (Chunk input)) => (Element input -> Bool) -> Parser input (Chunk input)

-- | Take the remaining elements from the current position in the stream
takeAll :: (ParserSource input, Sequential (Chunk input)) => Parser input (Chunk input)
skip :: ParserSource input => CountOf (Element input) -> Parser input ()
skipWhile :: (ParserSource input, Sequential (Chunk input)) => (Element input -> Bool) -> Parser input ()

-- | consume every chunk of the stream
skipAll :: (ParserSource input, Collection (Chunk input)) => Parser input ()
(<|>) :: Alternative f => f a -> f a -> f a
many :: Alternative f => f a -> f [a]
some :: Alternative f => f a -> f [a]
optional :: Alternative f => f a -> f (Maybe a)

-- | repeat the given parser a given amount of time
--   
--   Unlike <tt>some</tt> or <tt>many</tt>, this operation will bring more
--   precision on how many times you wish a parser to be sequenced.
--   
--   ## Repeat <tt>Exactly</tt> a number of time
--   
--   <pre>
--   repeat (Exactly 6) (takeWhile ((/=) ',') &lt;* element ',')
--   </pre>
--   
--   ## Repeat <tt>Between</tt> lower `<tt>And</tt>` upper times
--   
--   <pre>
--   repeat (Between $ 1 `And` 10) (takeWhile ((/=) ',') &lt;* element ',')
--   </pre>
repeat :: ParserSource input => Condition -> Parser input a -> Parser input [a]
data Condition
Between :: !And -> Condition
Exactly :: !Word -> Condition
data And
And :: !Word -> !Word -> And
instance GHC.Classes.Eq Foundation.Parser.NoMore
instance GHC.Show.Show Foundation.Parser.NoMore
instance GHC.Classes.Eq Foundation.Parser.And
instance GHC.Classes.Eq Foundation.Parser.Condition
instance GHC.Show.Show Foundation.Parser.Condition
instance GHC.Show.Show Foundation.Parser.And
instance GHC.Base.Functor (Foundation.Parser.Parser input)
instance Foundation.Parser.ParserSource input => GHC.Base.Applicative (Foundation.Parser.Parser input)
instance Foundation.Parser.ParserSource input => GHC.Base.Monad (Foundation.Parser.Parser input)
instance Foundation.Parser.ParserSource input => GHC.Base.MonadPlus (Foundation.Parser.Parser input)
instance Foundation.Parser.ParserSource input => GHC.Base.Alternative (Foundation.Parser.Parser input)
instance (GHC.Show.Show k, GHC.Show.Show input) => GHC.Show.Show (Foundation.Parser.Result input k)
instance GHC.Base.Functor (Foundation.Parser.Result input)
instance (Data.Typeable.Internal.Typeable input, GHC.Show.Show input) => GHC.Exception.Type.Exception (Foundation.Parser.ParseError input)
instance GHC.Show.Show input => GHC.Show.Show (Foundation.Parser.ParseError input)
instance GHC.Show.Show (Foundation.Parser.ParseError Basement.UTF8.Base.String)
instance Foundation.Parser.ParserSource Basement.UTF8.Base.String
instance Foundation.Parser.ParserSource [a]


-- | String Builder
module Foundation.String.Builder

-- | run the builder and return a <a>String</a>
--   
--   alias to <a>runUnsafe</a>
--   
--   This function is not safe, prefer <a>run</a>.
toString :: Builder -> String

module Foundation.String.Read
readInteger :: String -> Maybe Integer
readIntegral :: (HasNegation i, IntegralUpsize Word8 i, Additive i, Multiplicative i, IsIntegral i) => String -> Maybe i
readNatural :: String -> Maybe Natural
readDouble :: String -> Maybe Double
readRational :: String -> Maybe Rational
readFloatingExact :: String -> ReadFloatingCallback a -> Maybe a


module Foundation.System.Entropy

-- | Get some of the system entropy
getEntropy :: CountOf Word8 -> IO (UArray Word8)


-- | This module deals with the random subsystem abstractions.
--   
--   It provide 2 different set of abstractions:
--   
--   <ul>
--   <li>The first abstraction that allow a monad to generate random
--   through the <a>MonadRandom</a> class.</li>
--   <li>The second abstraction to make generic random generator
--   <a>RandomGen</a> and a small State monad like wrapper
--   <a>MonadRandomState</a> to abstract a generator.</li>
--   </ul>
module Foundation.Random

-- | A monad constraint that allows to generate random bytes
class (Functor m, Applicative m, Monad m) => MonadRandom m
getRandomBytes :: MonadRandom m => CountOf Word8 -> m (UArray Word8)
getRandomWord64 :: MonadRandom m => m Word64
getRandomF32 :: MonadRandom m => m Float
getRandomF64 :: MonadRandom m => m Double

-- | A Deterministic Random Generator (DRG) class
class RandomGen gen

-- | Initialize a new random generator
randomNew :: (RandomGen gen, MonadRandom m) => m gen

-- | Initialize a new random generator from a binary seed.
--   
--   If <a>Nothing</a> is returned, then the data is not acceptable for
--   creating a new random generator.
randomNewFrom :: RandomGen gen => UArray Word8 -> Maybe gen

-- | Generate N bytes of randomness from a DRG
randomGenerate :: RandomGen gen => CountOf Word8 -> gen -> (UArray Word8, gen)

-- | Generate a Word64 from a DRG
randomGenerateWord64 :: RandomGen gen => gen -> (Word64, gen)
randomGenerateF32 :: RandomGen gen => gen -> (Float, gen)
randomGenerateF64 :: RandomGen gen => gen -> (Double, gen)

-- | A simple Monad class very similar to a State Monad with the state
--   being a RandomGenerator.
newtype MonadRandomState gen a
MonadRandomState :: (gen -> (a, gen)) -> MonadRandomState gen a
[runRandomState] :: MonadRandomState gen a -> gen -> (a, gen)

-- | Run a pure computation with a Random Generator in the
--   <a>MonadRandomState</a>
withRandomGenerator :: RandomGen gen => gen -> MonadRandomState gen a -> (a, gen)

-- | An alias to the default choice of deterministic random number
--   generator
--   
--   Unless, you want to have the stability of a specific random number
--   generator, e.g. for tests purpose, it's recommended to use this alias
--   so that you would keep up to date with possible bugfixes, or change of
--   algorithms.
type RNG = RNGv1
type RNGv1 = State


-- | An implementation of a test framework and property expression &amp;
--   testing
module Foundation.Check

-- | Generator monad
data Gen a

-- | How to generate an arbitrary value for <tt>a</tt>
class Arbitrary a
arbitrary :: Arbitrary a => Gen a
oneof :: NonEmpty [Gen a] -> Gen a
elements :: NonEmpty [a] -> Gen a

-- | Call one of the generator weighted
frequency :: NonEmpty [(Word, Gen a)] -> Gen a
between :: (Word, Word) -> Gen Word

-- | different type of tests supported
data Test
[Unit] :: String -> IO () -> Test
[Property] :: IsProperty prop => String -> prop -> Test
[Group] :: String -> [Test] -> Test
[CheckPlan] :: String -> Check () -> Test

-- | Name of a test
testName :: Test -> String

-- | The type of check this test did for a property
data PropertyCheck
data Property
Prop :: Gen PropertyTestArg -> Property
[unProp] :: Property -> Gen PropertyTestArg
class IsProperty p
property :: IsProperty p => p -> Property

-- | A property that check for equality of its 2 members.
(===) :: (Show a, Eq a, Typeable a) => a -> a -> PropertyCheck
infix 4 ===

-- | A property that check for a specific comparaison of its 2 members.
--   
--   This is equivalent to <a>===</a> but with <a>compare</a>
propertyCompare :: (Show a, Typeable a) => String -> (a -> a -> Bool) -> a -> a -> PropertyCheck

-- | A property that check for a specific comparaison of its 2 members.
--   
--   This is equivalent to <a>===</a> but with <a>compare</a> and a given
--   method to pretty print the values.
propertyCompareWith :: String -> (a -> a -> Bool) -> (a -> String) -> a -> a -> PropertyCheck

-- | A conjuctive property composed of 2 properties that need to pass
propertyAnd :: PropertyCheck -> PropertyCheck -> PropertyCheck
propertyFail :: String -> PropertyCheck

-- | Running a generator for a specific type under a property
forAll :: (Show a, IsProperty prop) => Gen a -> (a -> prop) -> Property
data Check a
validate :: IsProperty prop => String -> prop -> Check ()
pick :: String -> IO a -> Check a
iterateProperty :: CountOf TestResult -> GenParams -> (Word64 -> GenRng) -> Property -> IO (PropertyResult, CountOf TestResult)


-- | An application to check that integrate with the .cabal test-suite
module Foundation.Check.Main

-- | Run tests
defaultMain :: Test -> IO ()
instance Control.Monad.IO.Class.MonadIO Foundation.Check.Main.CheckMain
instance GHC.Base.Monad Foundation.Check.Main.CheckMain
instance GHC.Base.Applicative Foundation.Check.Main.CheckMain
instance GHC.Base.Functor Foundation.Check.Main.CheckMain
instance Foundation.Monad.State.MonadState Foundation.Check.Main.CheckMain


module Foundation.System.Info
data OS
Windows :: OS
OSX :: OS
Linux :: OS
Android :: OS
BSD :: OS

-- | get the operating system on which the program is running.
--   
--   Either return the known <a>OS</a> or a strict <a>String</a> of the OS
--   name.
--   
--   This function uses the <tt>base</tt>'s <a>os</a> function.
os :: Either [Char] OS

-- | Enumeration of the known GHC supported architecture.
data Arch
I386 :: Arch
X86_64 :: Arch
PowerPC :: Arch
PowerPC64 :: Arch
Sparc :: Arch
Sparc64 :: Arch
ARM :: Arch
ARM64 :: Arch

-- | get the machine architecture on which the program is running
--   
--   Either return the known architecture or a Strict <a>String</a> of the
--   architecture name.
--   
--   This function uses the <tt>base</tt>'s <a>arch</a> function.
arch :: Either [Char] Arch

-- | returns the number of CPUs the machine has
cpus :: IO Int
data () => Endianness
LittleEndian :: Endianness
BigEndian :: Endianness
endianness :: Endianness

-- | get the compiler name
--   
--   get the compilerName from base package but convert it into a strict
--   String
compilerName :: String
compilerVersion :: Version
data () => Version
Version :: [Int] -> [String] -> Version
[versionBranch] :: Version -> [Int]
[versionTags] :: Version -> [String]
instance Data.Data.Data Foundation.System.Info.OS
instance GHC.Enum.Bounded Foundation.System.Info.OS
instance GHC.Enum.Enum Foundation.System.Info.OS
instance GHC.Classes.Ord Foundation.System.Info.OS
instance GHC.Classes.Eq Foundation.System.Info.OS
instance GHC.Show.Show Foundation.System.Info.OS
instance Data.Data.Data Foundation.System.Info.Arch
instance GHC.Enum.Bounded Foundation.System.Info.Arch
instance GHC.Enum.Enum Foundation.System.Info.Arch
instance GHC.Classes.Ord Foundation.System.Info.Arch
instance GHC.Classes.Eq Foundation.System.Info.Arch
instance GHC.Show.Show Foundation.System.Info.Arch


-- | An implementation of a timing framework
module Foundation.Time.Types

-- | An amount of nanoseconds
newtype NanoSeconds
NanoSeconds :: Word64 -> NanoSeconds

-- | An amount of seconds
newtype Seconds
Seconds :: Word64 -> Seconds
instance GHC.Enum.Bounded Foundation.Time.Types.NanoSeconds
instance GHC.Enum.Enum Foundation.Time.Types.NanoSeconds
instance Basement.Numerical.Additive.Additive Foundation.Time.Types.NanoSeconds
instance GHC.Classes.Ord Foundation.Time.Types.NanoSeconds
instance GHC.Classes.Eq Foundation.Time.Types.NanoSeconds
instance GHC.Show.Show Foundation.Time.Types.NanoSeconds
instance GHC.Enum.Bounded Foundation.Time.Types.Seconds
instance GHC.Enum.Enum Foundation.Time.Types.Seconds
instance Basement.Numerical.Additive.Additive Foundation.Time.Types.Seconds
instance GHC.Classes.Ord Foundation.Time.Types.Seconds
instance GHC.Classes.Eq Foundation.Time.Types.Seconds
instance GHC.Show.Show Foundation.Time.Types.Seconds
instance Basement.PrimType.PrimType Foundation.Time.Types.Seconds
instance Basement.PrimType.PrimType Foundation.Time.Types.NanoSeconds

module Foundation.Time.StopWatch

-- | A precise stop watch
--   
--   The precision is higher than a normal stopwatch, but also on some
--   system it might not be able to record longer period of time accurately
--   (possibly wrapping)
data StopWatchPrecise

-- | Create a new precise stop watch
--   
--   record the time at start of call
startPrecise :: IO StopWatchPrecise

-- | Get the number of nano seconds since the call to <a>startPrecise</a>
stopPrecise :: StopWatchPrecise -> IO NanoSeconds

module Foundation.Time.Bindings
measuringNanoSeconds :: IO a -> IO (a, NanoSeconds)
getMonotonicTime :: IO (Seconds, NanoSeconds)


-- | An implementation of a timing framework
module Foundation.Timing
data Timing
Timing :: !NanoSeconds -> !Maybe Word64 -> Timing
[timeDiff] :: Timing -> !NanoSeconds
[timeBytesAllocated] :: Timing -> !Maybe Word64
data Measure
Measure :: UArray NanoSeconds -> Word -> Measure
[measurements] :: Measure -> UArray NanoSeconds
[iters] :: Measure -> Word

-- | Simple one-time measurement of time &amp; other metrics spent in a
--   function
stopWatch :: (a -> b) -> a -> IO Timing

-- | In depth timing &amp; other metrics analysis of a function
measure :: Word -> (a -> b) -> a -> IO Measure


-- | An implementation of a timing framework
module Foundation.Timing.Main
defaultMain :: TimingPlan () -> IO ()
instance GHC.Base.Monad Foundation.Timing.Main.TimingPlan
instance GHC.Base.Applicative Foundation.Timing.Main.TimingPlan
instance GHC.Base.Functor Foundation.Timing.Main.TimingPlan


-- | IPv6 data type
module Foundation.Network.IPv6

-- | IPv6 data type
data IPv6

-- | equivalent to `::`
any :: IPv6

-- | equivalent to `::1`
loopback :: IPv6
fromString :: IsString a => String -> a

-- | serialise to human readable IPv6
--   
--   <pre>
--   &gt;&gt;&gt; toString (fromString "0:0:0:0:0:0:0:1" :: IPv6)
--   </pre>
toString :: IPv6 -> String

-- | create an IPv6 from the given tuple
fromTuple :: (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16) -> IPv6

-- | decompose an IPv6 into a tuple
toTuple :: IPv6 -> (Word16, Word16, Word16, Word16, Word16, Word16, Word16, Word16)

-- | IPv6 Parser as described in RFC4291
--   
--   for more details:
--   <a>https://tools.ietf.org/html/rfc4291.html#section-2.2</a>
--   
--   which is exactly:
--   
--   ``` ipv6ParserPreferred <a>|</a> ipv6ParserIPv4Embedded <a>|</a>
--   ipv6ParserCompressed ```
ipv6Parser :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6

-- | IPv6 parser as described in RFC4291 section 2.2.1
--   
--   The preferred form is x:x:x:x:x:x:x:x, where the <tt>x</tt>s are one
--   to four hexadecimal digits of the eight 16-bit pieces of the address.
--   
--   <ul>
--   <li>`ABCD:EF01:2345:6789:ABCD:EF01:2345:6789`</li>
--   <li>`2001:DB8:0:0:8:800:200C:417A`</li>
--   </ul>
ipv6ParserPreferred :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6

-- | IPv6 parser as described in RFC4291 section 2.2.2
--   
--   The use of "::" indicates one or more groups of 16 bits of zeros. The
--   "::" can only appear once in an address. The "::" can also be used to
--   compress leading or trailing zeros in an address.
--   
--   <ul>
--   <li>`2001:DB8::8:800:200C:417A`</li>
--   <li>`FF01::101`</li>
--   <li>`::1`</li>
--   <li>`::`</li>
--   </ul>
ipv6ParserCompressed :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6

-- | IPv6 address with embedded IPv4 address
--   
--   when dealing with a mixed environment of IPv4 and IPv6 nodes is
--   x:x:x:x:x:x:d.d.d.d, where the <tt>x</tt>s are the hexadecimal values
--   of the six high-order 16-bit pieces of the address, and the
--   <tt>d</tt>s are the decimal values of the four low-order 8-bit pieces
--   of the address (standard IPv4 representation).
--   
--   <ul>
--   <li>`0:0:0:0:0:0:13.1.68.3`</li>
--   <li>`0:0:0:0:0:FFFF:129.144.52.38`</li>
--   <li>`::13.1.68.3`</li>
--   <li>`::FFFF:129.144.52.38`</li>
--   </ul>
ipv6ParserIpv4Embedded :: (ParserSource input, Element input ~ Char, Element (Chunk input) ~ Char) => Parser input IPv6
instance GHC.Classes.Ord Foundation.Network.IPv6.IPv6
instance GHC.Classes.Eq Foundation.Network.IPv6.IPv6
instance Basement.NormalForm.NormalForm Foundation.Network.IPv6.IPv6
instance Foundation.Hashing.Hashable.Hashable Foundation.Network.IPv6.IPv6
instance GHC.Show.Show Foundation.Network.IPv6.IPv6
instance Data.String.IsString Foundation.Network.IPv6.IPv6
instance Foundation.Class.Storable.Storable Foundation.Network.IPv6.IPv6
instance Foundation.Class.Storable.StorableFixed Foundation.Network.IPv6.IPv6


-- | IPv4 data type
module Foundation.Network.IPv4

-- | IPv4 data type
data IPv4

-- | "0.0.0.0"
any :: IPv4

-- | "127.0.0.1"
loopback :: IPv4
fromString :: IsString a => String -> a
toString :: IPv4 -> String
fromTuple :: (Word8, Word8, Word8, Word8) -> IPv4
toTuple :: IPv4 -> (Word8, Word8, Word8, Word8)

-- | Parse a IPv4 address
ipv4Parser :: (ParserSource input, Element input ~ Char, Sequential (Chunk input), Element input ~ Element (Chunk input)) => Parser input IPv4
instance Foundation.Hashing.Hashable.Hashable Foundation.Network.IPv4.IPv4
instance GHC.Classes.Ord Foundation.Network.IPv4.IPv4
instance GHC.Classes.Eq Foundation.Network.IPv4.IPv4
instance GHC.Show.Show Foundation.Network.IPv4.IPv4
instance Basement.NormalForm.NormalForm Foundation.Network.IPv4.IPv4
instance Data.String.IsString Foundation.Network.IPv4.IPv4
instance Foundation.Class.Storable.Storable Foundation.Network.IPv4.IPv4
instance Foundation.Class.Storable.StorableFixed Foundation.Network.IPv4.IPv4


module Foundation.Hashing

-- | Type with the ability to be hashed
--   
--   Hashable doesn't have any specific rules, and it's made for raw speed.
--   More specifically don't expect different type representing the same
--   data to hash to the same value
--   
--   <pre>
--   hashMix (1 :: Integer) /= hashMix (1 :: Word8)
--   </pre>
--   
--   True
class Hashable a
hashMix :: (Hashable a, Hasher st) => a -> st -> st

-- | Incremental Hashing state. Represent an hashing algorithm
--   
--   the base primitive of this class is <a>hashMix8</a>, append mix a
--   Word8 in the state
--   
--   The class allow to define faster mixing function that works on bigger
--   Word size and any unboxed array of any PrimType elements
class Hasher st

-- | FNV1 32 bit state
data FNV1_32

-- | FNV1 64 bit state
data FNV1_64

-- | FNV1a 32 bit state
data FNV1a_32

-- | FNV1a 64 bit state
data FNV1a_64

-- | Sip State 1-3 (1 compression rounds, 3 digest rounds)
data Sip1_3

-- | Sip State 2-4 (2 compression rounds, 4 digest rounds)
data Sip2_4


-- | I tried to picture clusters of information As they moved through the
--   computer What do they look like?
--   
--   Alternative Prelude
module Foundation
($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
(&&) :: Bool -> Bool -> Bool
(||) :: Bool -> Bool -> Bool
(.) :: forall (b :: k) (c :: k) (a :: k). Category cat => cat b c -> cat a b -> cat a c
not :: Bool -> Bool
otherwise :: Bool

-- | Strict tuple (a,b)
data Tuple2 a b
Tuple2 :: !a -> !b -> Tuple2 a b

-- | Strict tuple (a,b,c)
data Tuple3 a b c
Tuple3 :: !a -> !b -> !c -> Tuple3 a b c

-- | Strict tuple (a,b,c,d)
data Tuple4 a b c d
Tuple4 :: !a -> !b -> !c -> !d -> Tuple4 a b c d

-- | Class of product types that have a first element
class Fstable a where {
    type ProductFirst a;
}
fst :: Fstable a => a -> ProductFirst a

-- | Class of product types that have a second element
class Sndable a where {
    type ProductSecond a;
}
snd :: Sndable a => a -> ProductSecond a

-- | Class of product types that have a third element
class Thdable a where {
    type ProductThird a;
}
thd :: Thdable a => a -> ProductThird a
id :: forall (a :: k). Category cat => cat a a
maybe :: b -> (a -> b) -> Maybe a -> b
either :: (a -> c) -> (b -> c) -> Either a b -> c
flip :: (a -> b -> c) -> b -> a -> c
const :: a -> b -> a
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => String -> a

-- | Print a string to standard output
putStr :: String -> IO ()

-- | Print a string with a newline to standard output
putStrLn :: String -> IO ()
getArgs :: IO [String]
uncurry :: (a -> b -> c) -> (a, b) -> c
curry :: ((a, b) -> c) -> a -> b -> c
swap :: (a, b) -> (b, a)
until :: (a -> Bool) -> (a -> a) -> a -> a
asTypeOf :: a -> a -> a
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b
class () => NormalForm a
deepseq :: NormalForm a => a -> b -> b
force :: NormalForm a => a -> a
class () => Show a
show :: Show a => a -> String
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
class () => Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
class () => Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a
class () => Enum a
succ :: Enum a => a -> a
pred :: Enum a => a -> a
toEnum :: Enum a => Int -> a
fromEnum :: Enum a => a -> Int
enumFrom :: Enum a => a -> [a]
enumFromThen :: Enum a => a -> a -> [a]
enumFromTo :: Enum a => a -> a -> [a]
enumFromThenTo :: Enum a => a -> a -> a -> [a]
class () => Functor (f :: Type -> Type)
fmap :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
class () => Integral a
fromInteger :: Integral a => Integer -> a
class () => Fractional a
fromRational :: Fractional a => Rational -> a
class () => HasNegation a
negate :: HasNegation a => a -> a
class forall a. () => Functor p a => Bifunctor (p :: Type -> Type -> Type)
bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
first :: Bifunctor p => (a -> b) -> p a c -> p b c
second :: Bifunctor p => (b -> c) -> p a b -> p a c
class Functor f => Applicative (f :: Type -> Type)
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
(*>) :: Applicative f => f a -> f b -> f b
(<*) :: Applicative f => f a -> f b -> f a
class Applicative m => Monad (m :: Type -> Type)
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
return :: Monad m => a -> m a
(=<<) :: Monad m => (a -> m b) -> m a -> m b
class () => IsString a
fromString :: IsString a => String -> a
class () => IsList l where {
    type family Item l;
}
fromList :: IsList l => [Item l] -> l
fromListN :: IsList l => Int -> [Item l] -> l
toList :: IsList l => l -> [Item l]
class (Integral a, Eq a, Ord a) => IsIntegral a
toInteger :: IsIntegral a => a -> Integer
class IsIntegral a => IsNatural a
toNatural :: IsNatural a => a -> Natural

-- | types that have sign and can be made absolute
class Signed a
abs :: Signed a => a -> a
signum :: Signed a => a -> Sign
class () => Additive a
azero :: Additive a => a
(+) :: Additive a => a -> a -> a
scale :: (Additive a, IsNatural n) => n -> a -> a
class () => Subtractive a where {
    type family Difference a;
}
(-) :: Subtractive a => a -> a -> Difference a
class () => Multiplicative a
midentity :: Multiplicative a => a
(*) :: Multiplicative a => a -> a -> a
(^) :: (Multiplicative a, IsNatural n, Enum n, IDivisible n) => a -> n -> a
class (Additive a, Multiplicative a) => IDivisible a
div :: IDivisible a => a -> a -> a
mod :: IDivisible a => a -> a -> a
divMod :: IDivisible a => a -> a -> (a, a)
class Multiplicative a => Divisible a
(/) :: Divisible a => a -> a -> a
data () => Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
data () => Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
data () => Bool
False :: Bool
True :: Bool
data () => Char
data () => Char7
data () => IO a
data () => Either a b
Left :: a -> Either a b
Right :: b -> Either a b
data () => Int8
data () => Int16
data () => Int32
data () => Int64
data () => Word8
data () => Word16
data () => Word32
data () => Word64
data () => Word
data () => Word128
data () => Word256
data () => Int
data () => Integer
data () => Natural
type Rational = Ratio Integer
data () => Float
data () => Double
newtype () => CountOf ty
CountOf :: Int -> CountOf ty
newtype () => Offset ty
Offset :: Int -> Offset ty
toCount :: Int -> CountOf ty
fromCount :: CountOf ty -> Int
data () => UArray ty
class Eq ty => PrimType ty
data () => Array a
data () => String
(^^) :: (Fractional a, Integral b) => a -> b -> a
fromIntegral :: (Integral a, Num b) => a -> b
realToFrac :: (Real a, Fractional b) => a -> b
class () => Semigroup a
class Semigroup a => Monoid a
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
(<>) :: Semigroup a => a -> a -> a

-- | A set of methods for ordered colection
class (IsList c, Item c ~ Element c) => Collection c

-- | Check if a collection is empty
null :: Collection c => c -> Bool

-- | Length of a collection (number of Element c)
length :: Collection c => c -> CountOf (Element c)

-- | Check if a collection contains a specific element
--   
--   This is the inverse of <a>notElem</a>.
elem :: forall a. (Collection c, Eq a, a ~ Element c) => Element c -> c -> Bool

-- | Check if a collection does *not* contain a specific element
--   
--   This is the inverse of <a>elem</a>.
notElem :: forall a. (Collection c, Eq a, a ~ Element c) => Element c -> c -> Bool

-- | Get the maximum element of a collection
maximum :: forall a. (Collection c, Ord a, a ~ Element c) => NonEmpty c -> Element c

-- | Get the minimum element of a collection
minimum :: forall a. (Collection c, Ord a, a ~ Element c) => NonEmpty c -> Element c

-- | Determine is any elements of the collection satisfy the predicate
any :: Collection c => (Element c -> Bool) -> c -> Bool

-- | Determine is all elements of the collection satisfy the predicate
all :: Collection c => (Element c -> Bool) -> c -> Bool

-- | Return True if all the elements in the collection are True
and :: (Collection col, Element col ~ Bool) => col -> Bool

-- | Return True if at least one element in the collection is True
or :: (Collection col, Element col ~ Bool) => col -> Bool

-- | A set of methods for ordered colection
class (IsList c, Item c ~ Element c, Monoid c, Collection c) => Sequential c

-- | Take the first @n elements of a collection
take :: Sequential c => CountOf (Element c) -> c -> c

-- | Take the last @n elements of a collection
revTake :: Sequential c => CountOf (Element c) -> c -> c

-- | Drop the first @n elements of a collection
drop :: Sequential c => CountOf (Element c) -> c -> c

-- | Drop the last @n elements of a collection
revDrop :: Sequential c => CountOf (Element c) -> c -> c

-- | Split the collection at the @n'th elements
splitAt :: Sequential c => CountOf (Element c) -> c -> (c, c)

-- | Split the collection at the @n'th elements from the end
revSplitAt :: Sequential c => CountOf (Element c) -> c -> (c, c)

-- | Split on a specific elements returning a list of colletion
splitOn :: Sequential c => (Element c -> Bool) -> c -> [c]

-- | Split a collection when the predicate return true
break :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection when the predicate return true starting from the
--   end of the collection
breakEnd :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection at the given element
breakElem :: (Sequential c, Eq (Element c)) => Element c -> c -> (c, c)

-- | Return the longest prefix in the collection that satisfy the predicate
takeWhile :: Sequential c => (Element c -> Bool) -> c -> c

-- | Return the longest prefix in the collection that satisfy the predicate
dropWhile :: Sequential c => (Element c -> Bool) -> c -> c

-- | The <a>intersperse</a> function takes an element and a list and
--   `intersperses' that element between the elements of the list. For
--   example,
--   
--   <pre>
--   intersperse ',' "abcde" == "a,b,c,d,e"
--   </pre>
intersperse :: Sequential c => Element c -> c -> c

-- | <a>intercalate</a> <tt>xs xss</tt> is equivalent to
--   <tt>(<a>mconcat</a> (<a>intersperse</a> xs xss))</tt>. It inserts the
--   list <tt>xs</tt> in between the lists in <tt>xss</tt> and concatenates
--   the result.
intercalate :: (Sequential c, Monoid (Item c)) => Element c -> c -> Element c

-- | Split a collection while the predicate return true
span :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Split a collection while the predicate return true starting from the
--   end of the collection
spanEnd :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Filter all the elements that satisfy the predicate
filter :: Sequential c => (Element c -> Bool) -> c -> c

-- | Partition the elements that satisfy the predicate and those that don't
partition :: Sequential c => (Element c -> Bool) -> c -> (c, c)

-- | Reverse a collection
reverse :: Sequential c => c -> c

-- | Decompose a collection into its first element and the remaining
--   collection. If the collection is empty, returns Nothing.
uncons :: Sequential c => c -> Maybe (Element c, c)

-- | Decompose a collection into a collection without its last element, and
--   the last element If the collection is empty, returns Nothing.
unsnoc :: Sequential c => c -> Maybe (c, Element c)

-- | Prepend an element to an ordered collection
snoc :: Sequential c => c -> Element c -> c

-- | Append an element to an ordered collection
cons :: Sequential c => Element c -> c -> c

-- | Find an element in an ordered collection
find :: Sequential c => (Element c -> Bool) -> c -> Maybe (Element c)

-- | Sort an ordered collection using the specified order function
sortBy :: Sequential c => (Element c -> Element c -> Ordering) -> c -> c

-- | Create a collection with a single element
singleton :: Sequential c => Element c -> c

-- | get the first element of a non-empty collection
head :: Sequential c => NonEmpty c -> Element c

-- | get the last element of a non-empty collection
last :: Sequential c => NonEmpty c -> Element c

-- | Extract the elements after the first element of a non-empty
--   collection.
tail :: Sequential c => NonEmpty c -> c

-- | Extract the elements before the last element of a non-empty
--   collection.
init :: Sequential c => NonEmpty c -> c

-- | Create a collection where the element in parameter is repeated N time
replicate :: Sequential c => CountOf (Element c) -> Element c -> c

-- | Takes two collections and returns True iff the first collection is a
--   prefix of the second.
isPrefixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   prefix of the second.
isPrefixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   suffix of the second.
isSuffixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is a
--   suffix of the second.
isSuffixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is an
--   infix of the second.
isInfixOf :: (Sequential c, Eq (Element c)) => c -> c -> Bool

-- | Takes two collections and returns True iff the first collection is an
--   infix of the second.
isInfixOf :: (Sequential c, Eq c) => c -> c -> Bool

-- | Try to strip a prefix from a collection
stripPrefix :: (Sequential c, Eq (Element c)) => c -> c -> Maybe c

-- | Try to strip a suffix from a collection
stripSuffix :: (Sequential c, Eq (Element c)) => c -> c -> Maybe c
data () => NonEmpty a

-- | Smart constructor to create a NonEmpty collection
--   
--   If the collection is empty, then Nothing is returned Otherwise, the
--   collection is wrapped in the NonEmpty property
nonEmpty :: Collection c => c -> Maybe (NonEmpty c)

-- | Give the ability to fold a collection on itself
class Foldable collection

-- | Left-associative fold of a structure.
--   
--   In the case of lists, foldl, when applied to a binary operator, a
--   starting value (typically the left-identity of the operator), and a
--   list, reduces the list using the binary operator, from left to right:
--   
--   <pre>
--   foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
--   </pre>
--   
--   Note that to produce the outermost application of the operator the
--   entire input list must be traversed. This means that foldl' will
--   diverge if given an infinite list.
--   
--   Note that Foundation only provides <a>foldl'</a>, a strict version of
--   <tt>foldl</tt> because the lazy version is seldom useful.
--   
--   Left-associative fold of a structure with strict application of the
--   operator.
foldl' :: Foldable collection => (a -> Element collection -> a) -> a -> collection -> a

-- | Right-associative fold of a structure.
--   
--   <pre>
--   foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
--   </pre>
foldr :: Foldable collection => (Element collection -> a -> a) -> a -> collection -> a

-- | Right-associative fold of a structure, but with strict application of
--   the operator.
foldr' :: Foldable collection => (Element collection -> a -> a) -> a -> collection -> a
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
catMaybes :: [Maybe a] -> [a]
fromMaybe :: a -> Maybe a -> a
isJust :: Maybe a -> Bool
isNothing :: Maybe a -> Bool
listToMaybe :: [a] -> Maybe a
maybeToList :: Maybe a -> [a]
partitionEithers :: [Either a b] -> ([a], [b])
lefts :: [Either a b] -> [a]
rights :: [Either a b] -> [b]
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<|>) :: Alternative f => f a -> f a -> f a
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e
displayException :: Exception e => e -> String
class () => Typeable (a :: k)
data () => SomeException
data () => IOException
data () => Proxy (t :: k)
Proxy :: Proxy (t :: k)
asProxyTypeOf :: a -> proxy a -> a

-- | Partialiality wrapper.
data Partial a

-- | Create a value that is partial. this can only be unwrap using the
--   <a>fromPartial</a> function
partial :: a -> Partial a

-- | An error related to the evaluation of a Partial value that failed.
--   
--   it contains the name of the function and the reason for failure
data PartialError

-- | Dewrap a possible partial value
fromPartial :: Partial a -> a
ifThenElse :: Bool -> a -> a -> a

-- | Alias to Prelude String ([Char]) for compatibility purpose
type LString = String


-- | a Generalized version of Fstable, Sndable, ..
--   
--   Using this module is limited to GHC 7.10 and above.
module Foundation.Tuple.Nth

-- | A generalized version of indexed accessor allowing access to tuples
--   n'th element.
--   
--   Indexing starts at 1, as <a>fst</a> is used to get first element.
class KnownNat n => Nthable n a where {
    type NthTy n a;
}
nth :: Nthable n a => proxy n -> a -> NthTy n a
instance Foundation.Tuple.Nth.Nthable 1 (a, b)
instance Foundation.Tuple.Nth.Nthable 2 (a, b)
instance Foundation.Tuple.Nth.Nthable 1 (Foundation.Tuple.Tuple2 a b)
instance Foundation.Tuple.Nth.Nthable 2 (Foundation.Tuple.Tuple2 a b)
instance Foundation.Tuple.Nth.Nthable 1 (a, b, c)
instance Foundation.Tuple.Nth.Nthable 2 (a, b, c)
instance Foundation.Tuple.Nth.Nthable 3 (a, b, c)
instance Foundation.Tuple.Nth.Nthable 1 (Foundation.Tuple.Tuple3 a b c)
instance Foundation.Tuple.Nth.Nthable 2 (Foundation.Tuple.Tuple3 a b c)
instance Foundation.Tuple.Nth.Nthable 3 (Foundation.Tuple.Tuple3 a b c)
instance Foundation.Tuple.Nth.Nthable 1 (a, b, c, d)
instance Foundation.Tuple.Nth.Nthable 2 (a, b, c, d)
instance Foundation.Tuple.Nth.Nthable 3 (a, b, c, d)
instance Foundation.Tuple.Nth.Nthable 4 (a, b, c, d)
instance Foundation.Tuple.Nth.Nthable 1 (Foundation.Tuple.Tuple4 a b c d)
instance Foundation.Tuple.Nth.Nthable 2 (Foundation.Tuple.Tuple4 a b c d)
instance Foundation.Tuple.Nth.Nthable 3 (Foundation.Tuple.Tuple4 a b c d)
instance Foundation.Tuple.Nth.Nthable 4 (Foundation.Tuple.Tuple4 a b c d)

module Foundation.UUID
data UUID
UUID :: {-# UNPACK #-} !Word64 -> {-# UNPACK #-} !Word64 -> UUID
newUUID :: MonadRandom randomly => randomly UUID
nil :: UUID
fromBinary :: UArray Word8 -> Maybe UUID
uuidParser :: (ParserSource input, Element input ~ Char, Sequential (Chunk input), Element input ~ Element (Chunk input)) => Parser input UUID
instance GHC.Classes.Ord Foundation.UUID.UUID
instance GHC.Classes.Eq Foundation.UUID.UUID
instance GHC.Show.Show Foundation.UUID.UUID
instance Basement.NormalForm.NormalForm Foundation.UUID.UUID
instance Foundation.Hashing.Hashable.Hashable Foundation.UUID.UUID
instance Foundation.Class.Storable.Storable Foundation.UUID.UUID
instance Foundation.Class.Storable.StorableFixed Foundation.UUID.UUID


module Foundation.VFS.Path

-- | Path type class
--   
--   defines the Path associated types and basic functions to implement
--   related to the path manipulation
--   
--   # TODO, add missing enhancement:
--   
--   <pre>
--   splitExtension :: PathEnt path -&gt; (PathEnt path, PathEnt path)
--   addExtension  :: PathEnt path -&gt; PathEnt path -&gt; PathEnt path
--   (<a>.</a>) :: path -&gt; PathEnt path -&gt; path
--   (-<a>.</a>) :: path -&gt; PathEnt path -&gt; path
--   </pre>
class Path path where {
    
    -- | the associated PathEntity of the given <tt>path</tt> this type is the
    --   minimal element contained in the Path a Path is not a collection but
    --   it is possible to see this associated type equivalent to the
    --   <a>Element</a> type family
    type PathEnt path;
    
    -- | the associated prefix of the given <tt>path</tt>
    --   
    --   in the case of a <a>FilePath</a>, it is a void (i.e. <tt>()</tt>) in
    --   the case of a <a>URI</a>, it is the schema, host, port...
    type PathPrefix path;
    
    -- | the associated suffix of the given path
    --   
    --   in the case of the <a>FilePath</a>, it is a void (i.e. <tt>()</tt>) in
    --   the case of the <a>URI</a>, it is a the query, the fragment
    type PathSuffix path;
}

-- | join a path entity to a given path
(</>) :: Path path => path -> PathEnt path -> path

-- | split the path into the associated elements
splitPath :: Path path => path -> (PathPrefix path, [PathEnt path], PathSuffix path)

-- | build the path from the associated elements
buildPath :: Path path => (PathPrefix path, [PathEnt path], PathSuffix path) -> path

-- | parent is only going to drop the filename.
--   
--   if you actually want to reference to the parent directory, simply
--   uses:
--   
--   <pre>
--   parent "." <i>= "." &lt;</i>&gt; ".."
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parent ("foo.hs" :: FilePath)
--   .
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parent ("foo/bar/baz.hs" :: FilePath)
--   foo/bar
--   </pre>
parent :: Path path => path -> path

-- | get the filename of the given path
--   
--   If there is no filename, you will receive the <a>mempty</a> of the
--   <a>PathEnt</a>
--   
--   <pre>
--   &gt;&gt;&gt; filename ("foo.hs" :: FilePath)
--   foo.hs
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; filename ("foo/bar/baz.hs" :: FilePath)
--   baz.hs
--   </pre>
filename :: (Path path, Monoid (PathEnt path)) => path -> PathEnt path

-- | get the path prefix information
--   
--   <pre>
--   &gt;&gt;&gt; prefix ("/home/tab" :: FilePath)
--   Absolute
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; prefix ("home/tab" :: FilePath)
--   Relative
--   </pre>
--   
--   or for URI (TODO, not yet accurate)
--   
--   <pre>
--   prefix "<a>http://github.com/vincenthz/hs-foundation?w=1"</a>
--      == URISchema http Nothing Nothing "github.com" Nothing
--   </pre>
prefix :: Path path => path -> PathPrefix path

-- | get the path suffix information
--   
--   <pre>
--   &gt;&gt;&gt; suffix ("/home/tab" :: FilePath)
--   ()
--   </pre>
--   
--   or for URI (TODO, not yet accurate)
--   
--   <pre>
--   suffix "<a>http://github.com/vincenthz/hs-foundation?w=1"</a>
--      == URISuffix (["w", "1"], Nothing)
--   </pre>
suffix :: Path path => path -> PathSuffix path


-- | # Opaque implementation for FilePath
--   
--   The underlying type of a FilePath is a <a>ByteArray</a>. It is indeed
--   like this because for some systems (Unix systems) a <a>FilePath</a> is
--   a null terminated array of bytes.
--   
--   # FilePath and FileName for type checking validation
--   
--   In order to add some constraint at compile time, it is not possible to
--   append (<a>&lt;/&gt;</a>) a <a>FilePath</a> to another
--   <a>FilePath</a>. You can only append (<a>&lt;/&gt;</a>) a
--   <a>FileName</a> to a given <a>FilePath</a>.
module Foundation.VFS.FilePath

-- | FilePath is a collection of FileName
--   
--   TODO: Eq and Ord are implemented using Show This is not very efficient
--   and would need to be improved Also, it is possible the ordering is not
--   necessary what we want in this case.
--   
--   A FilePath is one of the following:
--   
--   <ul>
--   <li>An Absolute:</li>
--   <li>starts with one of the follwing "/"</li>
--   <li>A relative:</li>
--   <li>don't start with a "/"</li>
--   <li>authorised:</li>
--   <li>"/"</li>
--   <li>"<i>file</i>path"</li>
--   <li>"."</li>
--   <li>".."</li>
--   <li>"work<i>haskell</i>hs-foundation"</li>
--   <li>unauthorised</li>
--   <li>"path//"</li>
--   </ul>
data FilePath

-- | information about type of FilePath
--   
--   A file path being only <a>Relative</a> or <a>Absolute</a>.
data Relativity
Absolute :: Relativity
Relative :: Relativity

-- | A filename (or path entity) in the FilePath
--   
--   <ul>
--   <li>Authorised</li>
--   <li>""</li>
--   <li>"."</li>
--   <li>".."</li>
--   <li>"foundation"</li>
--   <li>Unauthorised</li>
--   <li>"/"</li>
--   <li>"file/"</li>
--   <li>"/file"</li>
--   <li>"file/path"</li>
--   </ul>
data FileName
filePathToString :: FilePath -> String

-- | conversion of a FilePath into a list of Char
--   
--   this function may throw exceptions
filePathToLString :: FilePath -> [Char]

-- | build a file path from a given list of filename
--   
--   this is unsafe and is mainly needed for testing purpose
unsafeFilePath :: Relativity -> [FileName] -> FilePath

-- | build a file name from a given ByteArray
--   
--   this is unsafe and is mainly needed for testing purpose
unsafeFileName :: UArray Word8 -> FileName
extension :: FileName -> Maybe FileName
instance GHC.Show.Show Foundation.VFS.FilePath.Relativity
instance GHC.Classes.Eq Foundation.VFS.FilePath.Relativity
instance GHC.Show.Show Foundation.VFS.FilePath.FilePath_Invalid
instance GHC.Classes.Eq Foundation.VFS.FilePath.FileName
instance GHC.Show.Show Foundation.VFS.FilePath.FileName_Invalid
instance GHC.Exception.Type.Exception Foundation.VFS.FilePath.FileName_Invalid
instance Data.String.IsString Foundation.VFS.FilePath.FileName
instance GHC.Show.Show Foundation.VFS.FilePath.FilePath
instance GHC.Classes.Eq Foundation.VFS.FilePath.FilePath
instance GHC.Classes.Ord Foundation.VFS.FilePath.FilePath
instance Data.String.IsString Foundation.VFS.FilePath.FilePath
instance Foundation.VFS.Path.Path Foundation.VFS.FilePath.FilePath
instance GHC.Show.Show Foundation.VFS.FilePath.FileName
instance GHC.Base.Semigroup Foundation.VFS.FilePath.FileName
instance GHC.Base.Monoid Foundation.VFS.FilePath.FileName
instance GHC.Exception.Type.Exception Foundation.VFS.FilePath.FilePath_Invalid


module Foundation.VFS

-- | Path type class
--   
--   defines the Path associated types and basic functions to implement
--   related to the path manipulation
--   
--   # TODO, add missing enhancement:
--   
--   <pre>
--   splitExtension :: PathEnt path -&gt; (PathEnt path, PathEnt path)
--   addExtension  :: PathEnt path -&gt; PathEnt path -&gt; PathEnt path
--   (<a>.</a>) :: path -&gt; PathEnt path -&gt; path
--   (-<a>.</a>) :: path -&gt; PathEnt path -&gt; path
--   </pre>
class Path path where {
    
    -- | the associated PathEntity of the given <tt>path</tt> this type is the
    --   minimal element contained in the Path a Path is not a collection but
    --   it is possible to see this associated type equivalent to the
    --   <a>Element</a> type family
    type PathEnt path;
    
    -- | the associated prefix of the given <tt>path</tt>
    --   
    --   in the case of a <a>FilePath</a>, it is a void (i.e. <tt>()</tt>) in
    --   the case of a <a>URI</a>, it is the schema, host, port...
    type PathPrefix path;
    
    -- | the associated suffix of the given path
    --   
    --   in the case of the <a>FilePath</a>, it is a void (i.e. <tt>()</tt>) in
    --   the case of the <a>URI</a>, it is a the query, the fragment
    type PathSuffix path;
}

-- | join a path entity to a given path
(</>) :: Path path => path -> PathEnt path -> path

-- | split the path into the associated elements
splitPath :: Path path => path -> (PathPrefix path, [PathEnt path], PathSuffix path)

-- | build the path from the associated elements
buildPath :: Path path => (PathPrefix path, [PathEnt path], PathSuffix path) -> path

-- | get the filename of the given path
--   
--   If there is no filename, you will receive the <a>mempty</a> of the
--   <a>PathEnt</a>
--   
--   <pre>
--   &gt;&gt;&gt; filename ("foo.hs" :: FilePath)
--   foo.hs
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; filename ("foo/bar/baz.hs" :: FilePath)
--   baz.hs
--   </pre>
filename :: (Path path, Monoid (PathEnt path)) => path -> PathEnt path

-- | parent is only going to drop the filename.
--   
--   if you actually want to reference to the parent directory, simply
--   uses:
--   
--   <pre>
--   parent "." <i>= "." &lt;</i>&gt; ".."
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parent ("foo.hs" :: FilePath)
--   .
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parent ("foo/bar/baz.hs" :: FilePath)
--   foo/bar
--   </pre>
parent :: Path path => path -> path

-- | get the path prefix information
--   
--   <pre>
--   &gt;&gt;&gt; prefix ("/home/tab" :: FilePath)
--   Absolute
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; prefix ("home/tab" :: FilePath)
--   Relative
--   </pre>
--   
--   or for URI (TODO, not yet accurate)
--   
--   <pre>
--   prefix "<a>http://github.com/vincenthz/hs-foundation?w=1"</a>
--      == URISchema http Nothing Nothing "github.com" Nothing
--   </pre>
prefix :: Path path => path -> PathPrefix path

-- | get the path suffix information
--   
--   <pre>
--   &gt;&gt;&gt; suffix ("/home/tab" :: FilePath)
--   ()
--   </pre>
--   
--   or for URI (TODO, not yet accurate)
--   
--   <pre>
--   suffix "<a>http://github.com/vincenthz/hs-foundation?w=1"</a>
--      == URISuffix (["w", "1"], Nothing)
--   </pre>
suffix :: Path path => path -> PathSuffix path

-- | FilePath is a collection of FileName
--   
--   TODO: Eq and Ord are implemented using Show This is not very efficient
--   and would need to be improved Also, it is possible the ordering is not
--   necessary what we want in this case.
--   
--   A FilePath is one of the following:
--   
--   <ul>
--   <li>An Absolute:</li>
--   <li>starts with one of the follwing "/"</li>
--   <li>A relative:</li>
--   <li>don't start with a "/"</li>
--   <li>authorised:</li>
--   <li>"/"</li>
--   <li>"<i>file</i>path"</li>
--   <li>"."</li>
--   <li>".."</li>
--   <li>"work<i>haskell</i>hs-foundation"</li>
--   <li>unauthorised</li>
--   <li>"path//"</li>
--   </ul>
data FilePath

-- | A filename (or path entity) in the FilePath
--   
--   <ul>
--   <li>Authorised</li>
--   <li>""</li>
--   <li>"."</li>
--   <li>".."</li>
--   <li>"foundation"</li>
--   <li>Unauthorised</li>
--   <li>"/"</li>
--   <li>"file/"</li>
--   <li>"/file"</li>
--   <li>"file/path"</li>
--   </ul>
data FileName
filePathToString :: FilePath -> String

-- | conversion of a FilePath into a list of Char
--   
--   this function may throw exceptions
filePathToLString :: FilePath -> [Char]


-- | IO Routine
module Foundation.IO

-- | Print a string with a newline to standard output
putStrLn :: String -> IO ()

-- | Print a string to standard output
putStr :: String -> IO ()
stdin :: Handle
stdout :: Handle
data () => IOMode
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
ReadWriteMode :: IOMode

-- | list the file name in the given FilePath directory
--   
--   TODO: error management and not implemented yet getDirectory ::
--   FilePath -&gt; IO [FileName] getDirectory = undefined
--   
--   Open a new handle on the file
openFile :: FilePath -> IOMode -> IO Handle

-- | Close a handle
closeFile :: Handle -> IO ()

-- | <tt><a>withFile</a> filepath mode act</tt> opens a file using the
--   mode<tt> and run act</tt>. the by-product handle will be closed when
--   act finish, either normally or through an exception.
--   
--   The value returned is the result of act@
withFile :: FilePath -> IOMode -> (Handle -> IO r) -> IO r

-- | Read binary data directly from the specified <a>Handle</a>.
--   
--   First argument is the Handle to read from, and the second is the
--   number of bytes to read. It returns the bytes read, up to the
--   specified size, or an empty array if EOF has been reached.
--   
--   <a>hGet</a> is implemented in terms of <tt>hGetBuf</tt>.
hGet :: Handle -> Int -> IO (UArray Word8)
hPut :: Handle -> UArray Word8 -> IO ()

-- | Read a binary file and return the whole content in one contiguous
--   buffer.
readFile :: FilePath -> IO (UArray Word8)

module Foundation.Conduit

-- | A component of a conduit pipeline, which takes a stream of
--   <tt>input</tt>, produces a stream of <tt>output</tt>, performs actions
--   in the underlying <tt>monad</tt>, and produces a value of
--   <tt>result</tt> when no more output data is available.
data Conduit input output monad result
data ResourceT m a
newtype ZipSink i m r
ZipSink :: Conduit i () m r -> ZipSink i m r
[getZipSink] :: ZipSink i m r -> Conduit i () m r

-- | Await for a value from upstream.
await :: Conduit i o m (Maybe i)
awaitForever :: (input -> Conduit input output monad b) -> Conduit input output monad ()

-- | Send a value downstream.
yield :: Monad m => o -> Conduit i o m ()

-- | Send values downstream.
yields :: (Monad m, Foldable os, Element os ~ o) => os -> Conduit i o m ()

-- | Same as <a>yield</a>, but additionally takes a finalizer to be run if
--   the downstream component terminates.
yieldOr :: o -> m () -> Conduit i o m ()

-- | Provide leftover input to be consumed by the next component in the
--   current monadic binding.
leftover :: i -> Conduit i o m ()

-- | Run a conduit pipeline to completion.
runConduit :: Monad m => Conduit () () m r -> m r

-- | Run a pure conduit pipeline to completion.
runConduitPure :: Conduit () () Identity r -> r

-- | Run a conduit pipeline in a <a>ResourceT</a> context for acquiring
--   resources.
runConduitRes :: (MonadBracket m, MonadIO m) => Conduit () () (ResourceT m) r -> m r

-- | Send the output of the first Conduit component to the second Conduit
--   component.
fuse :: Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r

-- | Operator version of <a>fuse</a>.
(.|) :: Monad m => Conduit a b m () -> Conduit b c m r -> Conduit a c m r
infixr 2 .|
sourceFile :: MonadResource m => FilePath -> Conduit i (UArray Word8) m ()
sourceHandle :: MonadIO m => Handle -> Conduit i (UArray Word8) m ()
sinkFile :: MonadResource m => FilePath -> Conduit (UArray Word8) i m ()
sinkHandle :: MonadIO m => Handle -> Conduit (UArray Word8) o m ()
sinkList :: Monad m => Conduit i o m [i]
bracketConduit :: MonadResource m => IO a -> (a -> IO b) -> (a -> Conduit i o m r) -> Conduit i o m r


-- | Provies the support for Comma Separated Value
module Foundation.Format.CSV

-- | CSV Type
data CSV

-- | serialise the CSV document into a UTF8 string
csvStringBuilder :: CSV -> Builder
rowStringBuilder :: Row -> Builder
fieldStringBuilder :: Field -> Builder

-- | serialise the CSV document into a UTF8 encoded (Block Word8)
csvBlockBuilder :: CSV -> Builder
rowBlockBuilder :: Row -> Builder
fieldBlockBuilder :: Field -> Builder
rowC :: (Record row, Monad m) => Conduit row (Block Word8) m ()
file :: Parser String CSV
record :: Parser String Row
record_ :: forall row. (Typeable row, Record row) => Parser String row
field :: Parser String Field
recordC :: (Monad m, MonadThrow m) => Conduit String Row m ()

-- | CSV Row
data Row
class Record a
toRow :: Record a => a -> Row
fromRow :: Record a => Row -> Either String a

-- | CSV field
data Field
FieldInteger :: Integer -> Field
FieldDouble :: Double -> Field
FieldString :: String -> Escaping -> Field
data Escaping
NoEscape :: Escaping
Escape :: Escaping
DoubleEscape :: Escaping
class IsField a
toField :: IsField a => a -> Field
fromField :: IsField a => Field -> Either String a

-- | helper function to create a <a>FieldInteger</a>
integral :: Into Integer a => a -> Field
float :: Double -> Field

-- | heler function to create a FieldString.
--   
--   This function will findout automatically if an escaping is needed. if
--   you wish to perform the escaping manually, do not used this function
string :: String -> Field


-- | Note that the memory mapping is handled by the system, not at the
--   haskell level. The system can modify the content of the memory as any
--   moment under your feet.
--   
--   It also have the limitation of your system, no emulation or nice
--   handling of all those corners cases is attempted here.
--   
--   for example mapping a large file (&gt; 4G), on a 32 bits system is
--   likely to just fail or returns inconsistent result.
--   
--   In doubt, use <tt>readFile</tt> or other simple routine that brings
--   the content of the file in IO.
module Foundation.IO.FileMap

-- | Map in memory the whole content of a file.
--   
--   Once the array goes out of scope, the memory get (eventually) unmap
fileMapRead :: FilePath -> IO (UArray Word8)

-- | Map in memory the whole content of a file,
fileMapReadWith :: FilePath -> (UArray Word8 -> IO a) -> IO a


module Foundation.VFS.URI

-- | TODO this is not implemented yet
data URI
URI :: URI
data URISchema
URISchema :: URISchema
data URIAuthority
URIAuthority :: URIAuthority
data URIQuery
URIQuery :: URIQuery
data URIFragment
URIFragment :: URIFragment
data URIPath
URIPath :: URIPath
instance Foundation.VFS.Path.Path Foundation.VFS.URI.URI
