summaryrefslogtreecommitdiff
path: root/src/Data/BEncode.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/BEncode.hs')
-rw-r--r--src/Data/BEncode.hs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/Data/BEncode.hs b/src/Data/BEncode.hs
index 8768dac..a866a6e 100644
--- a/src/Data/BEncode.hs
+++ b/src/Data/BEncode.hs
@@ -643,7 +643,21 @@ endDict = Nil
643-- "length" < "md5sum" < "path" < "tags". 643-- "length" < "md5sum" < "path" < "tags".
644-- 644--
645newtype Get a = Get { runGet :: StateT BDict Result a } 645newtype Get a = Get { runGet :: StateT BDict Result a }
646 deriving (Functor, Applicative, Alternative, Monad) 646 deriving (Functor, Applicative, Alternative)
647
648-- | 'fail' is catchable from pure code.
649instance Monad Get where
650 return a = Get (return a)
651 {-# INLINE return #-}
652
653 Get m >>= f = Get (m >>= runGet . f)
654 {-# INLINE (>>=) #-}
655
656 Get m >> Get n = Get (m >> n)
657 {-# INLINE (>>) #-}
658
659 fail msg = Get (lift (Left msg))
660 {-# INLINE fail #-}
647 661
648-- | Get lexicographical successor of the current key\/value pair. 662-- | Get lexicographical successor of the current key\/value pair.
649next :: Get BValue 663next :: Get BValue