Search Haskell Channel Logs

Saturday, January 28, 2017

#haskell channel featuring lambdabot, shiona, athan, Rotaerk, cocreature,

athan 2017-01-27 21:10:25
What would you call a function `foo :: Monoid w => Maybe w -> w`?
athan 2017-01-27 21:10:44
`affinely`? :v (athan get's his space people dictionary)
Rotaerk 2017-01-27 21:15:17
foo = fromMaybe mempty?
Rotaerk 2017-01-27 21:17:18
there's maybeToList :: Maybe a -> [a]
Rotaerk 2017-01-27 21:17:40
so perhaps maybeToMonoid ?
athan 2017-01-27 21:19:30
Rotaerk: Ahh yeah that makes sense, idk I'm trying to think abstractly about this
athan 2017-01-27 21:19:50
what is Nothing compared to Just? I wouldn't call it pointed
athan 2017-01-27 21:20:03
shoot, maybe it is
shiona 2017-01-27 21:20:19
> fold $ (Nothing :: Maybe (Sum Int))
lambdabot 2017-01-27 21:20:22
Sum {getSum = 0}
athan 2017-01-27 21:22:01
well, I think that holds different meaning than fromMaybe or catMaybes shiona
athan 2017-01-27 21:22:28
er.. wait
athan 2017-01-27 21:22:41
s_s idk anymore
shiona 2017-01-27 21:24:43
I'm not sure myself. I just use hoogle to search for the type
athan 2017-01-27 21:25:20
I at least tried that kinda :)
athan 2017-01-27 21:25:22
thank you
shiona 2017-01-27 21:26:11
and given 'fold :: Monoid m, Foldable f => f m -> m' I don't see any other sensible definition for the case f ~ Maybe (I'm not sure that's how you use ~)
athan 2017-01-27 21:26:38
It is actually!
athan 2017-01-27 21:27:03
> fold (mempty :: (f ~ Maybe) => f (Sum Int))
lambdabot 2017-01-27 21:27:07
Sum {getSum = 0}
shiona 2017-01-27 21:27:37
nice
athan 2017-01-27 21:27:42
I think you're right, I don't know what I was getting at. Thank you again
cocreature 2017-01-27 21:28:21
oh, I didn't know about "fold". I've always used "foldMap id"
shiona 2017-01-27 21:29:18
no problem. I like how questions of all levels are thrown around here. When I see one that might be my level I try to come up with a solution and maybe learn some haskell myself.
athan 2017-01-27 21:30:41
I owe this community a lot
shiona 2017-01-27 21:30:50
same
cocreature 2017-01-27 21:31:21
without this irc channel I probably would have given up learning haskell quite early