Search Haskell Channel Logs

Tuesday, February 28, 2017

#haskell channel featuring glguy, dolio, mniip, hpc, Wizek,

Wizek 2017-02-28 14:55:07
Hey, anyone knows why this throws an exception instead of returning Left? `parseTimeM True defaultTimeLocale "%Y" "a" $> either (show .> ("fail: "<>)) ((show :: UTCTime -> _) .> ("parse: "<>)) where ($>) = flip ($)`
glguy 2017-02-28 14:56:24
because fail for either doesn't return a Left
glguy 2017-02-28 14:56:45
and that function is unfortunately defined to use fail for errors
Wizek 2017-02-28 14:56:58
that does sound deeply unfortunate
Wizek 2017-02-28 14:57:08
how come?
glguy 2017-02-28 14:57:27
you'd have to ask the author
hpc 2017-02-28 14:57:36
mniip: er, forgot about https://downloads.haskell.org/~ghc/7.8.2/docs/html/users_guide/roles.html too
mniip 2017-02-28 14:58:15
hpc, ???
hpc 2017-02-28 14:58:25
and the docs for State#
hpc 2017-02-28 14:59:02
basically, State# a has no underlying representation
hpc 2017-02-28 14:59:26
and in the unboxed tuple, the whole representation is just b
mniip 2017-02-28 14:59:27
right
hpc 2017-02-28 14:59:44
for IO that means IO a has the same representation as a
hpc 2017-02-28 14:59:50
which means ghc haskell is impure
hpc 2017-02-28 15:00:01
which it must necessarily be in order to admit unsafePerformIO in the first place
mniip 2017-02-28 15:00:16
I was asking a fairly specific question about calling conventions
mniip 2017-02-28 15:00:21
not generic IO stuff
hpc 2017-02-28 15:00:31
ah nvm then
mniip 2017-02-28 15:00:53
just noticed that you can operate on (# State# a, b #) in ghci without object code
mniip 2017-02-28 15:01:10
which means that by the time it hits the codegen there is already no unbox tuple
hpc 2017-02-28 15:03:06
probably part of the magic of State#
dolio 2017-02-28 15:08:13
I don't think representing `IO a` the same way as `a` necessarily makes you impure. It's giving access to that representation that makes you impure.
hpc 2017-02-28 15:12:18
dolio: yeah, i was taking a bit of license there ;)
hpc 2017-02-28 15:12:33
it's a pretty neat thing to learn for the first time though