SepakoRayl 2017-03-07 10:52:49
is there any reason to hold state wen parsing other than error reporting? I was taking a look at Happy and I can't think of any reason to ever keep state for non-error reporting purposes.
SepakoRayl 2017-03-07 10:54:27
I mean it should be possible to retrieve most data by working on the AST
okeuday_bak 2017-03-07 10:59:45
what am I doing wrong at https://github.com/okeuday/erlang_hs/blob/master/src/Foreign/Erlang.hs#L183-L185 with the Monad instance, it gives the error "Couldn't match type `PutMResult b' with `Either Error (Put.PutM b)', Expected type: Result (Put.PutM b), Actual type: PutMResult b"?
Koterpillar 2017-03-07 11:01:35
okeuday_bak: what's the type of k?
okeuday_bak 2017-03-07 11:02:10
Koterpillar: I thought it was PutResult, but I could be wrong, I need to read more about Monads probably
chilversc 2017-03-07 11:02:21
just trying the exercises on the site, and it says to pattern match (10,"abc") to get the letter 'a', so I used let (_,a:_) = (10, "abc") in a but the site has extra parens, (_,(a:_))
chilversc 2017-03-07 11:02:36
is the site just being more explicit or does leaving out the parens change it?
Koterpillar 2017-03-07 11:03:15
okeuday_bak: it is PutResult
Koterpillar 2017-03-07 11:03:23
okeuday_bak: but what is 'k r' then?
SepakoRayl 2017-03-07 11:03:37
nvm got it
Koterpillar 2017-03-07 11:03:38
oh, sorry, 'k r' would be PutResult
Koterpillar 2017-03-07 11:04:18
okeuday_bak: but next on, you're trying to construct PutResult (k r), where (k r) :: PutResult b
Koterpillar 2017-03-07 11:04:40
chilversc: try and find out
chilversc 2017-03-07 11:04:53
I did, I didn't notice a difference
Koterpillar 2017-03-07 11:05:05
then your guess is correct
okeuday_bak 2017-03-07 11:05:07
Koterpillar: yeah, I was attempting to use a Monad instance similar to Either, but that appears to be inappropriate because the Right side is that writer monad
lyxia 2017-03-07 11:06:14
chilversc: it's the same
Koterpillar 2017-03-07 11:06:14
okeuday_bak: is PutM a monad?
okeuday_bak 2017-03-07 11:06:53
Koterpillar: yes, that is my understanding, it is a type of writer monad
Koterpillar 2017-03-07 11:07:20
then yours is EitherT on top of it, right?
okeuday_bak 2017-03-07 11:07:47
Koterpillar: I am not yet using EitherT, should I be instead of Either to avoid problems?
Koterpillar 2017-03-07 11:08:11
you are rewriting EitherT
okeuday_bak 2017-03-07 11:08:17
Koterpillar: k, thanks
Koterpillar 2017-03-07 11:09:50
so either go with the types, or look up how it is implemented
okeuday_bak 2017-03-07 11:10:20
Koterpillar: yeah, I will read more about it and try using it instead
lyxia 2017-03-07 11:18:30
your constructors have a lot of overlap
lyxia 2017-03-07 11:19:03
Can you also paste some of the functions on these
mbw 2017-03-07 11:20:30
ok I'll try to find something representative. This might take me a moment, though.
mbw 2017-03-07 11:24:15
Is it ok if I just dump the whole thing? I don't know specifically *where* my life would've been easier, to be honest. This whole thing just feels wrong. It's about ~300 LOC, probably less without import/export lists.
lyxia 2017-03-07 11:25:19
300 is okay.
mbw 2017-03-07 11:26:02
I'll trim it down and post it.
lpaste_ 2017-03-07 11:31:25
lyxia annotated "Types" with "Factored Types" at http://lpaste.net/353296#a353297
lyxia 2017-03-07 11:31:25
mbw: ^
lyxia 2017-03-07 11:31:53
it looks neater but it's not necessarily more convenient depending on what you're doing with these types.