File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ class Unfoldable1 t <= Unfoldable t where
4141instance unfoldableArray :: Unfoldable Array where
4242 unfoldr = unfoldrArrayImpl isNothing (unsafePartial fromJust) fst snd
4343
44+ instance unfoldableMaybe :: Unfoldable Maybe where
45+ unfoldr f b = fst <$> f b
46+
4447foreign import unfoldrArrayImpl
4548 :: forall a b
4649 . (forall x . Maybe x -> Boolean )
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ class Unfoldable1 t where
4141instance unfoldable1Array :: Unfoldable1 Array where
4242 unfoldr1 = unfoldr1ArrayImpl isNothing (unsafePartial fromJust) fst snd
4343
44+ instance unfoldable1Maybe :: Unfoldable1 Maybe where
45+ unfoldr1 f b = Just (fst (f b))
46+
4447foreign import unfoldr1ArrayImpl
4548 :: forall a b
4649 . (forall x . Maybe x -> Boolean )
You can’t perform that action at this time.
0 commit comments