From e77e424fdbbc7b541a5542883f3d3559f9535340 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 17 Mar 2020 18:32:14 -0700 Subject: Add double fmap, switch "say" to Text, and autoformat --- Com/Simatime/Alpha.hs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Com/Simatime') diff --git a/Com/Simatime/Alpha.hs b/Com/Simatime/Alpha.hs index 438b97a..16d21e3 100644 --- a/Com/Simatime/Alpha.hs +++ b/Com/Simatime/Alpha.hs @@ -1,24 +1,33 @@ {-# LANGUAGE NoImplicitPrelude #-} -- | Commonly useful functions, a Prelude replacement. -module Com.Simatime.Alpha ( +module Com.Simatime.Alpha + ( -- * Re-export Protolude - module X + module X -- * General functions , (/@) + , (/@@) -- * Debugging tools , say -- * TODO: remove this , Prelude.read - ) where + ) +where +import Data.Text ( Text ) import qualified Prelude -import Protolude as X -import Data.String +import Protolude as X +import Data.String -- | Debugging printf -say :: String -> IO () +say :: Text -> IO () say msg = putStrLn msg --- | Alias for map, fmap, <$> +-- | Alias for map, fmap, <$>. Inspired by Mathematica. (/@) :: Functor f => (a -> b) -> f a -> f b (/@) = fmap + +-- | Double fmap. +-- (/@@) :: (Functor f1, Functor f2) => f1 (a -> b) -> f1 (f2 a) -> f1 (f2 b) +(/@@) :: (Functor f0, Functor f1) => (a -> b) -> f0 (f1 a) -> f0 (f1 b) +(/@@) = fmap . fmap -- cgit v1.2.3