summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Com/Simatime/Alpha.hs23
1 files changed, 16 insertions, 7 deletions
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