aboutsummaryrefslogtreecommitdiff
path: root/Graphics/Glyph/ArrayGenerator.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Graphics/Glyph/ArrayGenerator.hs')
-rw-r--r--Graphics/Glyph/ArrayGenerator.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Graphics/Glyph/ArrayGenerator.hs b/Graphics/Glyph/ArrayGenerator.hs
index 1e9e5a3..16fe41f 100644
--- a/Graphics/Glyph/ArrayGenerator.hs
+++ b/Graphics/Glyph/ArrayGenerator.hs
@@ -7,6 +7,18 @@ import Data.Array
import Data.Maybe
data ArrayTransaction ix val b = ArrayBuilderM_ (M.Map ix val) b
+
+instance (Ord ix) => Functor (ArrayTransaction ix a) where
+ fmap f bb = bb >>= (return . f)
+
+instance (Ord ix) => Applicative (ArrayTransaction ix a) where
+ (<*>) afn aa = do
+ fn <- afn
+ a <- aa
+ return (fn a)
+
+ pure = return
+
instance (Ord ix) => Monad (ArrayTransaction ix a) where
return = ArrayBuilderM_ M.empty
(ArrayBuilderM_ map1 val) >>= f =