summaryrefslogtreecommitdiff
path: root/src/runtime/haskell/Data/Binary/Put.hs
diff options
context:
space:
mode:
authorArianna Masciolini <uzkamascio@gmail.com>2025-08-02 23:01:53 +0200
committerArianna Masciolini <uzkamascio@gmail.com>2025-08-02 23:01:53 +0200
commit8f4e8c73d2d17ad49a6b72a93090a7a39e5d84f0 (patch)
tree478b68d1e493349f9e74b5c61862830012f2f2f3 /src/runtime/haskell/Data/Binary/Put.hs
parentc2431e06b2fcd53e71f06d54b1b74b102aed7590 (diff)
parentd983255326d232a9d0e1541e5b48743e6ce35e59 (diff)
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core into release-3.12
Diffstat (limited to 'src/runtime/haskell/Data/Binary/Put.hs')
-rw-r--r--src/runtime/haskell/Data/Binary/Put.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/runtime/haskell/Data/Binary/Put.hs b/src/runtime/haskell/Data/Binary/Put.hs
index 189cf806f..05d23fba6 100644
--- a/src/runtime/haskell/Data/Binary/Put.hs
+++ b/src/runtime/haskell/Data/Binary/Put.hs
@@ -77,15 +77,20 @@ instance Functor PutM where
{-# INLINE fmap #-}
instance Applicative PutM where
- pure = return
+ pure a = Put $ PairS a mempty
m <*> k = Put $
let PairS f w = unPut m
PairS x w' = unPut k
in PairS (f x) (w `mappend` w')
+ m *> k = Put $
+ let PairS _ w = unPut m
+ PairS b w' = unPut k
+ in PairS b (w `mappend` w')
+ {-# INLINE (*>) #-}
-- Standard Writer monad, with aggressive inlining
instance Monad PutM where
- return a = Put $ PairS a mempty
+ return = pure
{-# INLINE return #-}
m >>= k = Put $
@@ -94,10 +99,7 @@ instance Monad PutM where
in PairS b (w `mappend` w')
{-# INLINE (>>=) #-}
- m >> k = Put $
- let PairS _ w = unPut m
- PairS b w' = unPut k
- in PairS b (w `mappend` w')
+ (>>) = (*>)
{-# INLINE (>>) #-}
tell :: Builder -> Put