nickolay.kudasov at gmail.com
Fri Nov 8 08:40:10 UTC 2013
Take a look at monad-loops package .
Seems like you reinvented a version of untilJust .
Your version can be obtained by:
yourUntilJust :: (Monad m) => m a -> (a -> Maybe b) -> m
byourUntilJust m f = untilJust (liftM f m)
2013/11/8 Tony Morris <tonymorris at gmail.com>
> I have implemented a function for QuickCheck:
> untilJust :: Gen a -> (a -> Maybe b) -> Gen b
> I based it on the code for suchThat and suchThatMaybe.
> I am wondering if I have potentially re-implemented an existing function
> in part or full. In other words, is there an easier way of achieving
> this function without pulling the generator apart as much as I have in
> this implementation: http://lpaste.net/95317
> suchThat :: Gen a -> (a -> Bool) -> Gen a
> suchThatMaybe :: Gen a -> (a -> Bool) -> Gen (Maybe a)
> Tony Morris
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe