Skip to content

Commit 4244ae5

Browse files
authored
Merge pull request #1593 from Daniel-Diaz/foldable-source
[servant] Generalize type of Servant.Types.SourceT.source to any foldable
2 parents ed07f5a + 7c69652 commit 4244ae5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

changelog.d/1593

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
synopsis: Generalize type of Servant.Types.SourceT.source to any foldable.
2+
prs: 1593

servant/src/Servant/Types/SourceT.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ instance (QC.Arbitrary a, Monad m) => QC.Arbitrary (StepT m a) where
215215
-- >>> source "foo" :: SourceT Identity Char
216216
-- fromStepT (Effect (Identity (Yield 'f' (Yield 'o' (Yield 'o' Stop)))))
217217
--
218-
source :: [a] -> SourceT m a
218+
source :: Foldable f => f a -> SourceT m a
219219
source = fromStepT . foldr Yield Stop
220220

221221
-- | Get the answers.
@@ -272,7 +272,7 @@ mapMaybeStep p = go where
272272

273273
-- | Run action for each value in the 'SourceT'.
274274
--
275-
-- >>> foreach fail print (source "abc")
275+
-- >>> foreach fail print $ source ("abc" :: String)
276276
-- 'a'
277277
-- 'b'
278278
-- 'c'

0 commit comments

Comments
 (0)