diff options
| author | Chris Wells <chris@mathematicaster.org> | 2026-02-25 10:39:15 -0600 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2026-02-25 10:39:15 -0600 |
| commit | f2c4d486c0e5763b9fcd92987128df262233c1a9 (patch) | |
| tree | a78ac2fcd93b60daa80eb12fc8928f251377c35f /haskell/src/Prolog.hs | |
| download | templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.gz templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.bz2 templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.lz templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.xz templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.tar.zst templates-f2c4d486c0e5763b9fcd92987128df262233c1a9.zip | |
Diffstat (limited to 'haskell/src/Prolog.hs')
| -rw-r--r-- | haskell/src/Prolog.hs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/haskell/src/Prolog.hs b/haskell/src/Prolog.hs new file mode 100644 index 0000000..b435c5a --- /dev/null +++ b/haskell/src/Prolog.hs @@ -0,0 +1,54 @@ +module Prolog + ( + -- * Modules + module Control.Applicative + , module Control.Monad + , module Control.Monad.Identity + , module Control.Monad.IO.Class + , module Data.Bool + , module Data.Either + , module Data.Function + , module Data.Functor + , module Data.Maybe + -- * Types + , Generic + , Generic1 + , Typeable + , Generically (..) + , IsString (..) + -- * Functions + , ffmap + , (<<$>>) + , (<<&>>) + ) where + +import Control.Applicative +import Control.Monad +import Control.Monad.Identity +import Control.Monad.IO.Class +import Data.Bool +import Data.Either +import Data.Function +import Data.Functor +import Data.Maybe +import Data.Typeable (Typeable) +import Data.String (IsString (..)) +import GHC.Generics + + +-- | 'fmap' over nested functors +ffmap :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b) +ffmap = fmap fmap fmap +{-# INLINE ffmap #-} + +-- | infix version of 'fmap' +(<<$>>) :: (Functor f, Functor g) => (a -> b) -> f (g a) -> f (g b) +infixl 4 <<$>> +(<<$>>) = ffmap +{-# INLINE (<<$>>) #-} + +-- | flipped '(<<$>>)' +(<<&>>) :: (Functor f, Functor g) => f (g a) -> (a -> b) -> f (g b) +infixl 1 <<&>> +(<<&>>) = flip (<<$>>) +{-# INLINE (<<&>>) #-} |
