This commit is contained in:
Daniel Casanueva 2022-11-08 13:25:19 +09:00 committed by GitHub
commit 7bb7eb96e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

2
changelog.d/1593 Normal file
View File

@ -0,0 +1,2 @@
synopsis: Generalize type of Servant.Types.SourceT.source to any foldable.
prs: 1593

View File

@ -212,7 +212,7 @@ instance (QC.Arbitrary a, Monad m) => QC.Arbitrary (StepT m a) where
-- >>> source "foo" :: SourceT Identity Char
-- fromStepT (Effect (Identity (Yield 'f' (Yield 'o' (Yield 'o' Stop)))))
--
source :: [a] -> SourceT m a
source :: Foldable f => f a -> SourceT m a
source = fromStepT . foldr Yield Stop
-- | Get the answers.
@ -269,7 +269,7 @@ mapMaybeStep p = go where
-- | Run action for each value in the 'SourceT'.
--
-- >>> foreach fail print (source "abc")
-- >>> foreach fail print $ source ("abc" :: String)
-- 'a'
-- 'b'
-- 'c'