verifiable-expressions-0.4.0: An intermediate language for Hoare logic style verification.

Safe HaskellSafe
LanguageHaskell2010

Language.Expression

Description

Implements higher-ranked equivalents of Functor, Monad, Foldable and Traversable.

Synopsis

Documentation

class HFunctor (h :: (u -> *) -> u -> *) where Source #

Higher-ranked analogue of Functor.

Methods

hmap :: (forall b. t b -> t' b) -> h t a -> h t' a Source #

Higher-ranked analogue of fmap. Has a default implementation in terms of htraverse for HTraversable h.

hmap :: HTraversable h => (forall b. t b -> t' b) -> h t a -> h t' a Source #

Higher-ranked analogue of fmap. Has a default implementation in terms of htraverse for HTraversable h.

Instances

(HFunctor * op, HFunctor * (OpChoice ops)) => HFunctor * (OpChoice ((:) ((* -> *) -> * -> *) op ops)) Source # 

Methods

hmap :: (forall (b :: OpChoice ((((* -> *) -> * -> *) ': op) ops)). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (OpChoice ([] ((* -> *) -> * -> *))) Source # 

Methods

hmap :: (forall (b :: OpChoice [(* -> *) -> * -> *]). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (OpChoice ops) => HFunctor * (HFree' ops) Source # 

Methods

hmap :: (forall (b :: HFree' ops). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (Reverse u) Source # 

Methods

hmap :: (forall (b :: Reverse u). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (ReaderT u r) Source # 

Methods

hmap :: (forall (b :: ReaderT u r). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (Sum u f) Source # 

Methods

hmap :: (forall (b :: Sum u f). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (Product u f) Source # 

Methods

hmap :: (forall (b :: Product u f). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u h => HFunctor u (HFree u h) Source # 

Methods

hmap :: (forall (b :: HFree u h). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (BV u g) Source # 

Methods

hmap :: (forall (b :: BV u g). t b -> t' b) -> h t a -> h t' a Source #

HDuofunctor u h => HFunctor u (SFree u h) Source # 

Methods

hmap :: (forall (b :: SFree u h). t b -> t' b) -> h t a -> h t' a Source #

Functor f => HFunctor u (Compose * u f) Source # 

Methods

hmap :: (forall (b :: Compose * u f). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u h => HFunctor u (Scope u g h) Source # 

Methods

hmap :: (forall (b :: Scope u g h). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u h => HFunctor u (Scoped u h f) Source # 

Methods

hmap :: (forall (b :: Scoped u h f). t b -> t' b) -> h t a -> h t' a Source #

HFunctor u (GeneralOp u u op) Source # 

Methods

hmap :: (forall (b :: GeneralOp u u op). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * SimpleOp Source # 

Methods

hmap :: (forall (b :: SimpleOp). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * LogicOp Source # 

Methods

hmap :: (forall (b :: LogicOp). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (ExceptT e) Source # 

Methods

hmap :: (forall (b :: ExceptT e). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (StateT s) Source # 

Methods

hmap :: (forall (b :: StateT s). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (StateT s) Source # 

Methods

hmap :: (forall (b :: StateT s). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (WriterT w) Source # 

Methods

hmap :: (forall (b :: WriterT w). t b -> t' b) -> h t a -> h t' a Source #

HFunctor * (WriterT w) Source # 

Methods

hmap :: (forall (b :: WriterT w). t b -> t' b) -> h t a -> h t' a Source #

class HPointed h where Source #

Half of the higher-ranked analogue of Monad.

Minimal complete definition

hpure

Methods

hpure :: t a -> h t a Source #

Higher-ranked analogue of pure or return.

Instances

HPointed * (HFree' ops) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (Reverse k) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (ReaderT k r) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (Sum k f) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (HFree k h) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (BV k g) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k (SFree k h) Source # 

Methods

hpure :: t a -> h t a Source #

Applicative f => HPointed k (Compose * k f) Source # 

Methods

hpure :: t a -> h t a Source #

HPointed k h => HPointed k (Scope k g h) Source # 

Methods

hpure :: t a -> h t a Source #

class HBind h where Source #

Half of the higher-ranked analogue of Monad.

Minimal complete definition

(^>>=)

Methods

(^>>=) :: h t a -> (forall b. t b -> h t' b) -> h t' a infixr 1 Source #

Higher-ranked analogue of >>=.

Instances

HFunctor * (OpChoice ops) => HBind * (HFree' ops) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: HFree' ops). t b -> h t' b) -> h t' a Source #

HBind k (Reverse k) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: Reverse k). t b -> h t' b) -> h t' a Source #

HBind k (ReaderT k r) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: ReaderT k r). t b -> h t' b) -> h t' a Source #

HBind k (Sum k f) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: Sum k f). t b -> h t' b) -> h t' a Source #

HFunctor k h => HBind k (HFree k h) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: HFree k h). t b -> h t' b) -> h t' a Source #

HBind k (BV k g) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: BV k g). t b -> h t' b) -> h t' a Source #

HDuofunctor k h => HBind k (SFree k h) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: SFree k h). t b -> h t' b) -> h t' a Source #

Monad f => HBind k (Compose * k f) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: Compose * k f). t b -> h t' b) -> h t' a Source #

class (HFunctor h, HPointed h, HBind h) => HMonad h Source #

Higher-ranked analogue of Monad.

NB there's no such thing as HApplicative for a reason. Consider f :: h t a -> h t' a -> h (Product t t') a, i.e. the higher-ranked analogue of liftA2 (,) :: f a -> f b -> f (a, b). Unfortunately f can't exist, because Product pairs up values of the same type, and in our constructions, h potentially contains values of many types; a just happens to be the one at the top level. There's no guarantee that the two structures will have the same types inside to pair together.

Instances

HFunctor * (OpChoice ops) => HMonad * (HFree' ops) Source # 
HMonad k (Reverse k) Source # 
HMonad k (ReaderT k r) Source # 
HMonad k (Sum k f) Source # 
HFunctor k h => HMonad k (HFree k h) Source # 
HMonad k (BV k g) Source # 
HDuofunctor k h => HMonad k (SFree k h) Source # 

hliftM :: (HPointed h, HBind h) => (forall b. t b -> t' b) -> h t a -> h t' a Source #

Implements hmap from just an HPointed and HBind instance. Can be used to implement HFunctor for your HMonads that aren't HTraversable.

hjoin :: HBind h => h (h t) a -> h t a Source #

Higher-ranked analogue of join.

class HFunctor h => HTraversable h where Source #

Higher-ranked analogue of Traversable.

Minimal complete definition

htraverse | hsequence

Methods

htraverse :: Applicative f => (forall b. t b -> f (t' b)) -> h t a -> f (h t' a) Source #

Higher-ranked analogue of traverse.

hsequence :: Applicative f => h (Compose f t) a -> f (h t a) Source #

Higher-ranked analogue of sequenceA.

Instances

(HTraversable * op, HTraversable * (OpChoice ops)) => HTraversable * (OpChoice ((:) ((* -> *) -> * -> *) op ops)) Source # 

Methods

htraverse :: Applicative f => (forall (b :: OpChoice ((((* -> *) -> * -> *) ': op) ops)). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (OpChoice ((((* -> *) -> * -> *) ': op) ops)) f t) a -> f (h t a) Source #

HTraversable * (OpChoice ([] ((* -> *) -> * -> *))) Source # 

Methods

htraverse :: Applicative f => (forall (b :: OpChoice [(* -> *) -> * -> *]). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (OpChoice [(* -> *) -> * -> *]) f t) a -> f (h t a) Source #

HTraversable * (OpChoice ops) => HTraversable * (HFree' ops) Source # 

Methods

htraverse :: Applicative f => (forall (b :: HFree' ops). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (HFree' ops) f t) a -> f (h t a) Source #

HTraversable u (Reverse u) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Reverse u). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Reverse u) f t) a -> f (h t a) Source #

HTraversable u (Sum u f) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Sum u f). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Sum u f) f t) a -> f (h t a) Source #

HTraversable u (Product u f) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Product u f). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Product u f) f t) a -> f (h t a) Source #

HTraversable u h => HTraversable u (HFree u h) Source # 

Methods

htraverse :: Applicative f => (forall (b :: HFree u h). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (HFree u h) f t) a -> f (h t a) Source #

HTraversable u (BV u g) Source # 

Methods

htraverse :: Applicative f => (forall (b :: BV u g). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (BV u g) f t) a -> f (h t a) Source #

HDuotraversable u h => HTraversable u (SFree u h) Source # 

Methods

htraverse :: Applicative f => (forall (b :: SFree u h). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (SFree u h) f t) a -> f (h t a) Source #

Traversable f => HTraversable u (Compose * u f) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Compose * u f). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Compose * u f) f t) a -> f (h t a) Source #

HTraversable u h => HTraversable u (Scope u g h) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Scope u g h). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Scope u g h) f t) a -> f (h t a) Source #

HTraversable u h => HTraversable u (Scoped u h f) Source # 

Methods

htraverse :: Applicative f => (forall (b :: Scoped u h f). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (Scoped u h f) f t) a -> f (h t a) Source #

HTraversable u (GeneralOp u u op) Source # 

Methods

htraverse :: Applicative f => (forall (b :: GeneralOp u u op). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (GeneralOp u u op) f t) a -> f (h t a) Source #

HTraversable * SimpleOp Source # 

Methods

htraverse :: Applicative f => (forall (b :: SimpleOp). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * SimpleOp f t) a -> f (h t a) Source #

HTraversable * LogicOp Source # 

Methods

htraverse :: Applicative f => (forall (b :: LogicOp). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * LogicOp f t) a -> f (h t a) Source #

hfoldMapMonoid :: (HTraversable h, Monoid m) => (forall b. t b -> m) -> h t a -> m Source #

An HTraversable instance lets you do something similar to foldMap. For a more flexible operation, see hfoldMap.

hbindTraverse :: (HTraversable h, HMonad h, Applicative f) => (forall b. t b -> f (h t' b)) -> h t a -> f (h t' a) Source #

class HBifunctor (h :: (k -> *) -> (k -> *) -> k -> *) where Source #

Higher-ranked analogue of Bifunctor.

Methods

hbimap :: (forall b. s b -> s' b) -> (forall b. t b -> t' b) -> h s t a -> h s' t' a Source #

Higher-ranked analogue of bimap.

hfirst :: (forall b. s b -> s' b) -> h s t a -> h s' t a Source #

hsecond :: (forall b. t b -> t' b) -> h s t a -> h s t' a Source #

hbimap :: HBitraversable h => (forall b. s b -> s' b) -> (forall b. t b -> t' b) -> h s t a -> h s' t' a Source #

Higher-ranked analogue of bimap.

Instances

HBifunctor k (Sum k) Source # 

Methods

hbimap :: (forall (b :: Sum k). s b -> s' b) -> (forall (b :: Sum k). t b -> t' b) -> h s t a -> h s' t' a Source #

hfirst :: (forall (b :: Sum k). s b -> s' b) -> h s t a -> h s' t a Source #

hsecond :: (forall (b :: Sum k). t b -> t' b) -> h s t a -> h s t' a Source #

HBifunctor k (Product k) Source # 

Methods

hbimap :: (forall (b :: Product k). s b -> s' b) -> (forall (b :: Product k). t b -> t' b) -> h s t a -> h s' t' a Source #

hfirst :: (forall (b :: Product k). s b -> s' b) -> h s t a -> h s' t a Source #

hsecond :: (forall (b :: Product k). t b -> t' b) -> h s t a -> h s t' a Source #

HBifunctor k (BV k) Source # 

Methods

hbimap :: (forall (b :: BV k). s b -> s' b) -> (forall (b :: BV k). t b -> t' b) -> h s t a -> h s' t' a Source #

hfirst :: (forall (b :: BV k). s b -> s' b) -> h s t a -> h s' t a Source #

hsecond :: (forall (b :: BV k). t b -> t' b) -> h s t a -> h s t' a Source #

HFunctor k h => HBifunctor k (Scoped k h) Source # 

Methods

hbimap :: (forall (b :: Scoped k h). s b -> s' b) -> (forall (b :: Scoped k h). t b -> t' b) -> h s t a -> h s' t' a Source #

hfirst :: (forall (b :: Scoped k h). s b -> s' b) -> h s t a -> h s' t a Source #

hsecond :: (forall (b :: Scoped k h). t b -> t' b) -> h s t a -> h s t' a Source #

class HBifunctor h => HBitraversable h where Source #

Minimal complete definition

hbitraverse

Methods

hbitraverse :: Applicative f => (forall b. s b -> f (s' b)) -> (forall b. t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

Instances

HBitraversable k (Sum k) Source # 

Methods

hbitraverse :: Applicative f => (forall (b :: Sum k). s b -> f (s' b)) -> (forall (b :: Sum k). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

HBitraversable k (Product k) Source # 

Methods

hbitraverse :: Applicative f => (forall (b :: Product k). s b -> f (s' b)) -> (forall (b :: Product k). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

HBitraversable k (BV k) Source # 

Methods

hbitraverse :: Applicative f => (forall (b :: BV k). s b -> f (s' b)) -> (forall (b :: BV k). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

HTraversable k h => HBitraversable k (Scoped k h) Source # 

Methods

hbitraverse :: Applicative f => (forall (b :: Scoped k h). s b -> f (s' b)) -> (forall (b :: Scoped k h). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

hbifoldMapMonoid :: (Monoid m, HBitraversable h) => (forall b. s b -> m) -> (forall b. t b -> m) -> h s t a -> m Source #

class HDuofunctor (h :: ((u -> *) -> u -> *) -> (u -> *) -> u -> *) where Source #

Methods

hduomap :: (forall g g' b. (forall c. g c -> g' c) -> s g b -> s' g' b) -> (forall b. t b -> t' b) -> h s t a -> h s' t' a Source #

hduomap :: HDuotraversable h => (forall g g' b. (forall c. g c -> g' c) -> s g b -> s' g' b) -> (forall b. t b -> t' b) -> h s t a -> h s' t' a Source #

Instances

HDuofunctor u (HFree u) Source # 

Methods

hduomap :: (forall (g :: HFree u -> *) (g' :: HFree u -> *) (b :: HFree u). (forall (c :: HFree u). g c -> g' c) -> s g b -> s' g' b) -> (forall (b :: HFree u). t b -> t' b) -> h s t a -> h s' t' a Source #

HDuofunctor u (Scope u g) Source # 

Methods

hduomap :: (forall (a :: Scope u g -> *) (g' :: Scope u g -> *) (b :: Scope u g). (forall (c :: Scope u g). a c -> g' c) -> s a b -> s' g' b) -> (forall (b :: Scope u g). t b -> t' b) -> h s t a -> h s' t' a Source #

hduomapFirst :: HDuofunctor h => (forall g g' b. (forall c. g c -> g' c) -> s g b -> s' g' b) -> h s t a -> h s' t a Source #

hduomapFirst' :: (HDuofunctor h, HFunctor s) => (forall g b. s g b -> s' g b) -> h s t a -> h s' t a Source #

hduomapSecond :: (HDuofunctor h, HFunctor s) => (forall b. t b -> t' b) -> h s t a -> h s t' a Source #

class HDuofunctor h => HDuotraversable h where Source #

Minimal complete definition

hduotraverse

Methods

hduotraverse :: Applicative f => (forall g g' b. (forall c. g c -> f (g' c)) -> s g b -> f (s' g' b)) -> (forall b. t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

Instances

HDuotraversable u (HFree u) Source # 

Methods

hduotraverse :: Applicative f => (forall (g :: HFree u -> *) (g' :: HFree u -> *) (b :: HFree u). (forall (c :: HFree u). g c -> f (g' c)) -> s g b -> f (s' g' b)) -> (forall (b :: HFree u). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

HDuotraversable u (Scope u g) Source # 

Methods

hduotraverse :: Applicative f => (forall (a :: Scope u g -> *) (g' :: Scope u g -> *) (b :: Scope u g). (forall (c :: Scope u g). a c -> f (g' c)) -> s a b -> f (s' g' b)) -> (forall (b :: Scope u g). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

hduotraverseFirst :: (HDuotraversable h, Applicative f) => (forall g g' b. (forall c. g c -> f (g' c)) -> s g b -> f (s' g' b)) -> h s t a -> f (h s' t a) Source #

hduotraverseFirst' :: (HDuotraversable h, HTraversable s, Monad f) => (forall g b. s g b -> f (s' g b)) -> h s t a -> f (h s' t a) Source #

hduotraverseSecond :: (HDuotraversable h, HTraversable s, Applicative f) => (forall b. t b -> f (t' b)) -> h s t a -> f (h s t' a) Source #

class HFoldableAt k h where Source #

This is a more flexible, higher-ranked version of Foldable. While Foldable only allows you to fold into a Monoid, HFoldable allows you to fold into some arbitrary type constructor k. This means that the instance can take advantage of additional structure inside k and h, to combine internal results in different ways, rather than just the mappend available to foldMap.

Notice that if you have

instance (Monoid m) => HFoldableAt (Const m) h

then hfoldMap behaves very much like regular foldMap.

Minimal complete definition

hfoldMap

Methods

hfoldMap :: (forall b. t b -> k b) -> h t a -> k a Source #

Instances

(HFoldableAt * k op, HFoldableAt * k (OpChoice ops)) => HFoldableAt * k (OpChoice ((:) ((* -> *) -> * -> *) op ops)) Source # 

Methods

hfoldMap :: (forall (b :: k). t b -> OpChoice ((((* -> *) -> * -> *) ': op) ops) b) -> h t a -> OpChoice ((((* -> *) -> * -> *) ': op) ops) a Source #

HFoldableAt * k (OpChoice ([] ((* -> *) -> * -> *))) Source # 

Methods

hfoldMap :: (forall (b :: k). t b -> OpChoice [(* -> *) -> * -> *] b) -> h t a -> OpChoice [(* -> *) -> * -> *] a Source #

(HFoldableAt * k (OpChoice ops), HFunctor * (OpChoice ops)) => HFoldableAt * k (HFree' ops) Source # 

Methods

hfoldMap :: (forall (b :: k). t b -> HFree' ops b) -> h t a -> HFree' ops a Source #

HFoldableAt k1 k2 (Reverse k1) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> Reverse k1 b) -> h t a -> Reverse k1 a Source #

HFoldableAt k1 k2 (Sum k1 k2) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> Sum k1 k2 b) -> h t a -> Sum k1 k2 a Source #

HFoldableAt k1 k2 h => HFoldableAt k1 k2 (HFree k1 h) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> HFree k1 h b) -> h t a -> HFree k1 h a Source #

(HDuotraversable k1 h, HDuofoldableAt k1 k2 h) => HFoldableAt k1 k2 (SFree k1 h) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> SFree k1 h b) -> h t a -> SFree k1 h a Source #

EvalOpAt k1 k2 op => HFoldableAt k1 k2 (GeneralOp k1 k1 op) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> GeneralOp k1 k1 op b) -> h t a -> GeneralOp k1 k1 op a Source #

HFoldableAt * Identity SimpleOp Source # 

Methods

hfoldMap :: (forall (b :: Identity). t b -> SimpleOp b) -> h t a -> SimpleOp a Source #

HFoldableAt * Identity LogicOp Source # 

Methods

hfoldMap :: (forall (b :: Identity). t b -> LogicOp b) -> h t a -> LogicOp a Source #

HFoldableAt * SBV SimpleOp Source # 

Methods

hfoldMap :: (forall (b :: SBV). t b -> SimpleOp b) -> h t a -> SimpleOp a Source #

HFoldableAt * SBV LogicOp Source # 

Methods

hfoldMap :: (forall (b :: SBV). t b -> LogicOp b) -> h t a -> LogicOp a Source #

Alternative k => HFoldableAt * k (Product * k) Source # 

Methods

hfoldMap :: (forall (b :: k). t b -> Product * k b) -> h t a -> Product * k a Source #

(Alternative g, Foldable f) => HFoldableAt * g (Compose * * f) Source #

e.g. (Monoid m, Foldable f) => HFoldableAt (Const m) (Compose f)

Methods

hfoldMap :: (forall (b :: g). t b -> Compose * * f b) -> h t a -> Compose * * f a Source #

implHfoldMap :: HFunctor h => (h k a -> k a) -> (forall b. t b -> k b) -> h t a -> k a Source #

For HFunctors, provides an implementation of hfoldMap in terms of a simple hfold-like function.

implHfoldMapCompose :: (HTraversable h, Monad m) => (h k a -> m (k a)) -> (forall b. t b -> Compose m k b) -> h t a -> Compose m k a Source #

A helper function for implementing instances with the general form Monad m => HFoldableAt (Compose m t) h. I.e. folding that requires a monadic context of some kind.

hfold :: HFoldableAt t h => h t a -> t a Source #

Higher-ranked equivalent of fold.

hfoldA :: (HFoldableAt (Compose f t) h, Applicative f) => h t a -> f (t a) Source #

Fold in an applicative context.

hfoldMapA :: (HFoldableAt (Compose f k) h, Applicative f) => (forall b. t b -> f (k b)) -> h t a -> f (k a) Source #

Fold in an applicative context.

hfoldTraverse :: (HFoldableAt k h, HTraversable h, Applicative f) => (forall b. t b -> f (k b)) -> h t a -> f (k a) Source #

class HBifoldableAt k h where Source #

Minimal complete definition

hbifoldMap

Methods

hbifoldMap :: (forall b. f b -> k b) -> (forall b. g b -> k b) -> h f g a -> k a Source #

Instances

HBifoldableAt k1 k2 (Sum k1) Source # 

Methods

hbifoldMap :: (forall (b :: k2). f b -> Sum k1 b) -> (forall (b :: k2). g b -> Sum k1 b) -> h f g a -> Sum k1 a Source #

HBifoldableAt k1 k2 (BV k1) Source # 

Methods

hbifoldMap :: (forall (b :: k2). f b -> BV k1 b) -> (forall (b :: k2). g b -> BV k1 b) -> h f g a -> BV k1 a Source #

(HFunctor k1 h, HFoldableAt k1 k2 h) => HBifoldableAt k1 k2 (Scoped k1 h) Source # 

Methods

hbifoldMap :: (forall (b :: k2). f b -> Scoped k1 h b) -> (forall (b :: k2). g b -> Scoped k1 h b) -> h f g a -> Scoped k1 h a Source #

Alternative k => HBifoldableAt * k (Product *) Source # 

Methods

hbifoldMap :: (forall (b :: k). f b -> Product * b) -> (forall (b :: k). g b -> Product * b) -> h f g a -> Product * a Source #

hbifold :: HBifoldableAt k h => h k k a -> k a Source #

class HDuofoldableAt k h where Source #

Minimal complete definition

hduofoldMap

Methods

hduofoldMap :: HTraversable s => (forall g b. (forall c. g c -> k c) -> s g b -> k b) -> (forall b. t b -> k b) -> h s t a -> k a Source #

Instances

HDuofoldableAt u k (HFree u) Source # 

Methods

hduofoldMap :: HTraversable k s => (forall (g :: k -> *) (b :: k). (forall (c :: k). g c -> HFree u c) -> s g b -> HFree u b) -> (forall (b :: k). t b -> HFree u b) -> h s t a -> HFree u a Source #

HDuofoldableAt k1 k2 (Scope k1 k2) Source # 

Methods

hduofoldMap :: HTraversable k2 s => (forall (g :: k2 -> *) (b :: k2). (forall (c :: k2). g c -> Scope k1 k2 c) -> s g b -> Scope k1 k2 b) -> (forall (b :: k2). t b -> Scope k1 k2 b) -> h s t a -> Scope k1 k2 a Source #

implHduofoldMap :: (HDuofunctor h, HFunctor s) => ((forall g b. (forall c. g c -> k c) -> s g b -> k b) -> h s k a -> k a) -> (forall g b. (forall c. g c -> k c) -> s g b -> k b) -> (forall b. t b -> k b) -> h s t a -> k a Source #

implHduofoldMapCompose :: (HDuotraversable h, HTraversable s, Monad m) => ((forall g b. (forall c. g c -> m (k c)) -> s g b -> m (k b)) -> h s k a -> m (k a)) -> (forall g b. (forall c. g c -> Compose m k c) -> s g b -> Compose m k b) -> (forall b. t b -> Compose m k b) -> h s t a -> Compose m k a Source #

data HFree h t a Source #

HFree h is a higher-ranked free monad over the higher-ranked functor h. That means that given HFunctor h, we get HMonad (HFree h) for free.

Constructors

HPure (t a) 
HWrap (h (HFree h t) a) 

Instances

HDuofoldableAt u k (HFree u) Source # 

Methods

hduofoldMap :: HTraversable k s => (forall (g :: k -> *) (b :: k). (forall (c :: k). g c -> HFree u c) -> s g b -> HFree u b) -> (forall (b :: k). t b -> HFree u b) -> h s t a -> HFree u a Source #

HFoldableAt k1 k2 h => HFoldableAt k1 k2 (HFree k1 h) Source # 

Methods

hfoldMap :: (forall (b :: k2). t b -> HFree k1 h b) -> h t a -> HFree k1 h a Source #

Pretty2 k k op => Pretty2 k k (HFree k op) Source # 

Methods

pretty2 :: Pretty1 (HFree k op) t => op t a -> String Source #

prettys2Prec :: Pretty1 (HFree k op) t => Int -> op t a -> ShowS Source #

HDuotraversable u (HFree u) Source # 

Methods

hduotraverse :: Applicative f => (forall (g :: HFree u -> *) (g' :: HFree u -> *) (b :: HFree u). (forall (c :: HFree u). g c -> f (g' c)) -> s g b -> f (s' g' b)) -> (forall (b :: HFree u). t b -> f (t' b)) -> h s t a -> f (h s' t' a) Source #

HDuofunctor u (HFree u) Source # 

Methods

hduomap :: (forall (g :: HFree u -> *) (g' :: HFree u -> *) (b :: HFree u). (forall (c :: HFree u). g c -> g' c) -> s g b -> s' g' b) -> (forall (b :: HFree u). t b -> t' b) -> h s t a -> h s' t' a Source #

HTraversable u h => HTraversable u (HFree u h) Source # 

Methods

htraverse :: Applicative f => (forall (b :: HFree u h). t b -> f (t' b)) -> h t a -> f (h t' a) Source #

hsequence :: Applicative f => h (Compose * (HFree u h) f t) a -> f (h t a) Source #

HFunctor k h => HMonad k (HFree k h) Source # 
HFunctor k h => HBind k (HFree k h) Source # 

Methods

(^>>=) :: h t a -> (forall (b :: HFree k h). t b -> h t' b) -> h t' a Source #

HPointed k (HFree k h) Source # 

Methods

hpure :: t a -> h t a Source #

HFunctor u h => HFunctor u (HFree u h) Source # 

Methods

hmap :: (forall (b :: HFree u h). t b -> t' b) -> h t a -> h t' a Source #

Num (WhileExpr l AlgReal) # 
IsString s => IsString (WhileExpr s AlgReal) #