- 2021-05-24, Monday:
Map.partitionWithKey's discriminator is
p :: k -> a -> Bool
But I have a function that discriminates only on the key:
part :: k -> Bool
write a function that translates my discriminator that can be used by Map.partitionWithKey:
g :: (k -> Bool) -> (k -> a -> Bool)
- Social Justice Cleric @noaheasterly:
g = (const .)
- Social Justice Cleric @noaheasterly:
- 2021-05-09, Sunday:
THE SEQUEL!
Okay, kinda the same, ... but not:
You have:
f :: m a
You want:g :: b -> m b
Where
g
runsf
, but accepts an argument,b
.
g
drops the result off
(... on the floor? idk)
g
returns the argumentb
lifted to the domain,m
GO!
- Denis Stoyanov Ant @xgrommx:
g (phantom . pure)
This is just joke) - Social Justice Cleric @noaheasterly:
(f $>)
- Denis Stoyanov Ant @xgrommx:
- 2021-05-08, Saturday: two-parter
- You have
f :: a -> m b
You wantg :: a -> m a
That is to say:
g
is a function that returns the input and drops the output off
.so:
blah :: (a -> m b) -> (a -> m a)
- What is a gooder name for the
blah
-function?
- Jonathan Cast #AJAA #Resist @jonathanccast:
returnArg = (*>) <$> f <*> return
- Social Justice Cleric @noaheasterly:
liftA2 (<*)
- You have
Incorporates strong typing over predicate logic programming, and, conversely, incorporates predicate logic programming into strongly typed functional languages. The style of predicate logic is from Prolog; the strongly typed functional language is Haskell.
Saturday, May 8, 2021
May 2021 1HaskellADay 1Liners: problems and solutions
Subscribe to:
Posts (Atom)