- December 29th, 2017:

given f :: Monad m => n -> a -> m (Maybe b)

define g :: Monad m => n -> a -> m (a, Maybe b)

using f and ... arrows? Kleisli category? - Bazzargh @bazzargh (\n a->liftM ((,) a) (f n a)) ... according to pointfree.io, that's `liftM2 fmap (,) . f` but I can't pretend to get the transformation
- December 29th, 2017:

given f :: a -> b

define g :: [a] -> [Maybe c] -> [(b, c)]

>>> g [1,2,3] [Just 7, Nothing, Just 10]

[("1",7),("3",10)]

when f = show - matt @themattchan

g = catMaybes ... zipWith (fmap . (,) . f)

where (...) = (.).(.) - garrison @GarrisonLJ g a b = map (f.id***fromJust) . filter (isJust . snd) $ zip a b
- TJ Takei @karoyakani g = (catMaybes .) . zipWith ((<$>) . (,) . f)
- December 29th, 2017: define f :: [(a,b)] -> ([a], [b])
- Андреев Кирилл @nonaem00 and matt @themattchan unzip
- Victoria C @ToriconPrime f = fmap fst &&& fmap snd
- (in a vacuum, a more general type signature would be inferred, but the compiler limits itself as instruct)

## Friday, January 5, 2018

### December 2017 1HaskellADay 1Liners problems and solutions

Subscribe to:
Post Comments (Atom)

## No comments:

Post a Comment