Skip to content

Commit 6ef5088

Browse files
gabejohnsonLiamGoodacre
authored andcommitted
Match formatting of other modules
1 parent f75e4d0 commit 6ef5088

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

src/Data/Compactable.purs

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@ class Compactable f where
6262
separate :: forall l r.
6363
f (Either l r) -> { left :: f l, right :: f r }
6464

65-
compactDefault :: forall f a. Functor f => Compactable f => f (Maybe a) -> f a
65+
compactDefault :: forall f a. Functor f => Compactable f =>
66+
f (Maybe a) -> f a
6667
compactDefault = _.right <<< separate <<< map (note unit)
6768

68-
separateDefault
69-
:: forall f l r
70-
. Functor f
71-
=> Compactable f
72-
=> f (Either l r) -> { left :: f l, right :: f r}
69+
separateDefault :: forall f l r. Functor f => Compactable f =>
70+
f (Either l r) -> { left :: f l, right :: f r}
7371
separateDefault xs = { left: compact $ (hush <<< swapEither) <$> xs
7472
, right: compact $ hush <$> xs
7573
}
@@ -105,12 +103,8 @@ instance compactableList :: Compactable List.List where
105103
compact = List.catMaybes
106104
separate xs = separateSequence xs
107105

108-
separateSequence
109-
:: forall f l r
110-
. Alternative f
111-
=> Foldable f
112-
=> Compactable f
113-
=> f (Either l r) -> { left :: f l, right :: f r }
106+
separateSequence :: forall f l r. Alternative f => Foldable f => Compactable f =>
107+
f (Either l r) -> { left :: f l, right :: f r }
114108
separateSequence = foldl go { left: empty, right: empty } where
115109
go acc = case _ of
116110
Left l -> acc { left = acc.left <|> pure l }
@@ -127,33 +121,22 @@ instance compactableMap :: Ord k => Compactable (Map.Map k) where
127121
Left l -> { left: Map.insert k l left, right }
128122
Right r -> { left: left, right: Map.insert k r right }
129123

130-
mapToList :: forall k v. Ord k => Map.Map k v -> List.List (Tuple k v)
124+
mapToList :: forall k v. Ord k =>
125+
Map.Map k v -> List.List (Tuple k v)
131126
mapToList = Map.toUnfoldable
132127

133-
applyMaybe
134-
:: forall f a b
135-
. Apply f
136-
=> Compactable f
137-
=> f (a -> Maybe b) -> f a -> f b
128+
applyMaybe :: forall f a b. Apply f => Compactable f =>
129+
f (a -> Maybe b) -> f a -> f b
138130
applyMaybe p = compact <<< apply p
139131

140-
applyEither
141-
:: forall f a l r
142-
. Apply f
143-
=> Compactable f
144-
=> f (a -> Either l r) -> f a -> { left :: f l, right :: f r }
132+
applyEither :: forall f a l r. Apply f => Compactable f =>
133+
f (a -> Either l r) -> f a -> { left :: f l, right :: f r }
145134
applyEither p = separate <<< apply p
146135

147-
bindMaybe
148-
:: forall m a b
149-
. Bind m
150-
=> Compactable m
151-
=> m a -> (a -> m (Maybe b)) -> m b
136+
bindMaybe :: forall m a b. Bind m => Compactable m =>
137+
m a -> (a -> m (Maybe b)) -> m b
152138
bindMaybe x = compact <<< bind x
153139

154-
bindEither
155-
:: forall m a l r
156-
. Bind m
157-
=> Compactable m
158-
=> m a -> (a -> m (Either l r)) -> { left :: m l, right :: m r }
140+
bindEither :: forall m a l r. Bind m => Compactable m =>
141+
m a -> (a -> m (Either l r)) -> { left :: m l, right :: m r }
159142
bindEither x = separate <<< bind x

0 commit comments

Comments
 (0)