Search Haskell Channel Logs

Friday, February 3, 2017

#haskell channel featuring jophish, ocharles, ph88, tdammers, lpaste, merijn,

ph88 2017-02-02 23:45:14
the point is that i was adding "P: " or "A: " to the trace message so that i could see if the function was used by 1 monad or the other .. but now in the return i loose this monad information because now i'm in the list monad ..
ph88 2017-02-02 23:45:32
yes you're right this is not gonna type check and work
ph88 2017-02-02 23:45:54
ah maybe i could write trace blabla $ return blabla
ocharles 2017-02-02 23:46:26
that return will need a type signature, because it's ambiguous which Monad's return you would be using
lpaste 2017-02-02 23:46:36
simli pasted "Proxy confusion" at http://lpaste.net/352039
ocharles 2017-02-02 23:46:39
`trace blablah` doesn't give you enough information to know what `f` should be
simli 2017-02-02 23:46:41
ocharles: ^
ph88 2017-02-02 23:47:18
yes i got it, this type checked: trace ("DecimalLiteral return " ++ d1 ++ dz ++ ex) $ return $ T.pack $ (d1 ++ dz ++ ex)
ocharles 2017-02-02 23:47:24
simli: I think you need {-# LANGUAGE ScopedTypeVariables #-}, then change line 32 of your paste to: sourceMessage :: forall a m. (MonadThrow m, Encode a, TypedMessage a) => a -> Producer m BS.ByteString
ph88 2017-02-02 23:47:38
thanks for thinking along ocharles :)
simli 2017-02-02 23:48:18
ocharles: oh my, haskell is heavy on the type theory :P
ocharles 2017-02-02 23:48:48
simli: without that extension, the 'a' type variable in "Proxy :: Proxy a" is not necessarily the same as the one in the type signature to sourceMessage.
simli 2017-02-02 23:49:48
ocharles: so the extensions basically give types a scope where they normally don't have one at all? (except for the signature itself)
simli 2017-02-02 23:49:56
*extension
ocharles 2017-02-02 23:50:01
yep, I'd say that sounds right
ocharles 2017-02-02 23:50:41
It's a shame that Data.Proxy doesn't have `proxyFor :: a -> Proxy a`, because then you could use `proxyFor message` (because that *does* have the type 'a' that you want)
ph88 2017-02-02 23:51:40
when making a parser and choosing from 2 different parsers parserA <|> parserB i see often that try is used like try parserA <|> try parserB is there some situation where you want to choose but NOT use try for each parser ?
ocharles 2017-02-02 23:52:22
When they don't share a common prefix
simli 2017-02-02 23:52:24
ocharles: I would have run into this either way since what I really want is to validate the messageType field in sinkMessage, where no instance is available :)
ph88 2017-02-02 23:52:48
ocharles, ah ok good point !
ocharles 2017-02-02 23:53:10
simli: Ah, right.
simli 2017-02-02 23:53:28
ocharles: the forall a m. part was what was missing btw, already had ScopedTypeVariables.
ocharles 2017-02-02 23:53:38
👍
simli 2017-02-02 23:53:47
thanks for the help!
jophish 2017-02-02 23:57:12
ski: yeah :|
roxxik 2017-02-03 00:00:51
ocharles: that's trivial to write yourself: proxyFor :: a -> Proxy a; proxyFor _ = Proxy, just from the top of my head, but i think it should work, and i wrote this one in several project already... so yeah it would be nice to have that in Data.Proxy
ocharles 2017-02-03 00:01:27
Yes, that's the implementation, just surprised Data.Proxy doesn't have it
tdammers 2017-02-03 00:02:38
jophish: bitbucket. https://bitbucket.org/tdammers/casing
jophish 2017-02-03 00:18:08
gotcha, thanks tdammers
noan_ 2017-02-03 00:33:41
WHELP, back to basics for me I think
noan_ 2017-02-03 00:33:41
https://gist.github.com/AlexaDeWit/ec8ccc64255625d77a99dae6e533de0d
merijn 2017-02-03 00:37:48
noan_: tbh, starting at line 1 that's already leaving beginner territory :p
noan_ 2017-02-03 00:38:06
that's just ripped out of the servant docs
noan_ 2017-02-03 00:38:15
I understand basically nothing about these combinators.
noan_ 2017-02-03 00:38:27
And I'm pretty hazy on haskell evaluation order too
noan_ 2017-02-03 00:38:40
infix operators get my brain all fucky.
merijn 2017-02-03 00:39:20
noan_: Yeah, don't feel bad, because DataKinds and TypeOperator are extensions that really don't make things easy if you're not already fairly comfortable with the basics
phadej 2017-02-03 00:39:43
's Post
phadej 2017-02-03 00:39:45
not POST
phadej 2017-02-03 00:39:49
It's*
phadej 2017-02-03 00:40:35
http://hackage.haskell.org/package/servant-0.10/docs/Servant-API-Verbs.html#t:Post
phadej 2017-02-03 00:40:53
there is POST as well, but it's used in different place..
noan_ 2017-02-03 00:42:07
mother of fuck
noan_ 2017-02-03 00:42:22
>no issues
noan_ 2017-02-03 00:42:28
phadej, IT IS ALWAYS A GODDAMN TYPO
noan_ 2017-02-03 00:42:30
:D
noan_ 2017-02-03 00:44:56
That's a hard one for me to spot, owing to the actual request on the browser being POST