File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ import Data.Maybe (Maybe(..), fromMaybe)
50
50
import Data.Newtype (class Newtype )
51
51
import Data.Tuple (Tuple (..), fst , snd )
52
52
import Data.Unfoldable (class Unfoldable )
53
+ import Data.Unfoldable1 (class Unfoldable1 )
53
54
import Effect.Class (class MonadEffect , liftEffect )
54
55
55
56
-- | The list monad transformer.
@@ -282,8 +283,17 @@ instance functorListT :: Functor f => Functor (ListT f) where
282
283
283
284
instance unfoldableListT :: Monad f => Unfoldable (ListT f ) where
284
285
unfoldr f b = go (f b)
285
- where go Nothing = nil
286
- go (Just (Tuple x y)) = cons (pure x) (defer \_ -> (go (f y)))
286
+ where
287
+ go = case _ of
288
+ Nothing -> nil
289
+ Just (Tuple x y) -> cons (pure x) (defer \_ -> (go (f y)))
290
+
291
+ instance unfoldable1ListT :: Monad f => Unfoldable1 (ListT f ) where
292
+ unfoldr1 f b = go (f b)
293
+ where
294
+ go = case _ of
295
+ Tuple x Nothing -> singleton x
296
+ Tuple x (Just y) -> cons (pure x) (defer \_ -> (go (f y)))
287
297
288
298
instance applyListT :: Monad f => Apply (ListT f ) where
289
299
apply = ap
You can’t perform that action at this time.
0 commit comments