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
41
41
instance unfoldableArray :: Unfoldable Array where
42
42
unfoldr = unfoldrArrayImpl isNothing (unsafePartial fromJust) fst snd
43
43
44
+ instance unfoldableMaybe :: Unfoldable Maybe where
45
+ unfoldr f b = fst <$> f b
46
+
44
47
foreign import unfoldrArrayImpl
45
48
:: forall a b
46
49
. (forall x . Maybe x -> Boolean )
Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ class Unfoldable1 t where
41
41
instance unfoldable1Array :: Unfoldable1 Array where
42
42
unfoldr1 = unfoldr1ArrayImpl isNothing (unsafePartial fromJust) fst snd
43
43
44
+ instance unfoldable1Maybe :: Unfoldable1 Maybe where
45
+ unfoldr1 f b = Just (fst (f b))
46
+
44
47
foreign import unfoldr1ArrayImpl
45
48
:: forall a b
46
49
. (forall x . Maybe x -> Boolean )
You can’t perform that action at this time.
0 commit comments