From f2c4d486c0e5763b9fcd92987128df262233c1a9 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Wed, 25 Feb 2026 10:39:15 -0600 Subject: Basic templates so far --- haskell/src/Prolog.hs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 haskell/src/Prolog.hs (limited to 'haskell/src') 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 (<<&>>) #-} -- cgit v1.2.3