lambdabot 2017-02-06 01:45:11
Sum {getSum = 15}
hpc 2017-02-06 01:45:15
> let xs = map Product [1, 2, 3, 4, 5] in mconcat xs
lambdabot 2017-02-06 01:45:21
Product {getProduct = 120}
merijn 2017-02-06 01:45:58
> getProduct . mconcat . coerce $ [1..10]
lambdabot 2017-02-06 01:46:01
error:
lambdabot 2017-02-06 01:46:01
Variable not in scope: coerce :: [Integer] -> [Product c]
merijn 2017-02-06 01:46:04
awww
hpc 2017-02-06 01:46:09
map coerce
merijn 2017-02-06 01:46:13
no Data.Coerce ? :(
merijn 2017-02-06 01:46:15
hpc: No
hpc 2017-02-06 01:46:23
oh dang, didn't read the error
merijn 2017-02-06 01:46:27
hpc: That's the entire point of coerce, to avoid the map
hpc 2017-02-06 01:46:43
fair point
dramforever 2017-02-06 01:48:41
> getProduct . mconcat . Data.Coerce.coerce $ [1..10]
dramforever 2017-02-06 01:48:44
> getProduct . mconcat . Data.Coerce.coerce $ [1..10]
lambdabot 2017-02-06 01:48:47
error:
lambdabot 2017-02-06 01:48:47
Not in scope: 'Data.Coerce.coerce'
lambdabot 2017-02-06 01:48:47
No module named 'Data.Coerce' is imported.
hpc 2017-02-06 01:48:58
@let import Data.Coerce
dramforever 2017-02-06 01:49:00
no Data.Coerce . :(
lambdabot 2017-02-06 01:49:01
.L.hs:80:1: error:
lambdabot 2017-02-06 01:49:01
Data.Coerce: Can't be safely imported!
lambdabot 2017-02-06 01:49:01
The module itself isn't safe.
hpc 2017-02-06 01:49:04
and there you go
dramforever 2017-02-06 01:49:27
Production usage of Safe Haskell :)
hpc 2017-02-06 01:49:43
yeah, i can't wait for {-# Safe #-} to become the default
Edith 2017-02-06 01:51:58
Can anyone recommend me a good library for interfacing with SDL? Only 2D drawing is necessary
hpc 2017-02-06 01:52:16
gloss maybe
hpc 2017-02-06 01:53:01
(technically it builds the window with GLUT, but both still do drawing via opengl)
BernhardPosselt 2017-02-06 01:53:05
regarding lifting: lifting is basically taking a function and making it work on another type, correct?
BernhardPosselt 2017-02-06 01:53:17
which often can be implemented in a generic fashion
dramforever 2017-02-06 01:54:05
Which is often more general than one would expect
BernhardPosselt 2017-02-06 01:54:33
e.g. liftM makes function work on monads
hpc 2017-02-06 01:54:39
it doesn't always have to be a function
hpc 2017-02-06 01:54:40
:t lift
lambdabot 2017-02-06 01:54:42
(MonadTrans t, Monad m) => m a -> t m a
hpc 2017-02-06 01:55:05
but yes, it's a type of transformation that on some level keeps something "the same"
dramforever 2017-02-06 01:55:23
those things would normally be functions/methods in other languages...
Darwin226 2017-02-06 01:56:38
Edith: https://hackage.haskell.org/package/sdl2 is really nice in my experience
Edith 2017-02-06 01:56:55
Thanks
BernhardPosselt 2017-02-06 01:57:18
i wish things like that were explained a bit more practical, e.g. "this is a problem we run into, so we refactor it and make it generic like this"
BernhardPosselt 2017-02-06 01:57:34
rather than giving you the type signature and laws :D
hpc 2017-02-06 01:58:38
to teach some concepts like that, you'd be listing problems for days
BernhardPosselt 2017-02-06 01:59:06
you dont have to cover each use case :)
BernhardPosselt 2017-02-06 01:59:14
one or two are enough
BernhardPosselt 2017-02-06 02:01:11
as in: when explaining summation you only need to explain it with ints and floats maybe, complex numbers/quaternials/matrices are nice but dont really add that much anymore to your understanding
dramforever 2017-02-06 02:01:47
There's a thing called 'paper' for that, I suppose
dramforever 2017-02-06 02:03:51
BernhardPosselt: Does this qualify as 'explained more practical'? http://www.staff.city.ac.uk/~ross/papers/Applicative.html
dramforever 2017-02-06 02:04:02
Actually this PDF http://www.staff.city.ac.uk/~ross/papers/Applicative.pdf
BernhardPosselt 2017-02-06 02:05:12
dramforever: thanks!
BernhardPosselt 2017-02-06 02:05:32
sounds good
BernhardPosselt 2017-02-06 02:05:44
however i think good papers are a bit rare
dramforever 2017-02-06 02:06:30
And yes, DI with Reader is apparently a thing: https://medium.com/@johnmcclean/dependency-injection-using-the-reader-monad-in-java8-9056d9501c75#.bkju7szbr
johan1 2017-02-06 02:07:51
++
Xnuk 2017-02-06 02:18:06
<>
merijn 2017-02-06 02:31:04
argh
dramforever 2017-02-06 02:32:29
lyxia: It's so nice I can't believe my eyes: http://lpaste.net/352136
merijn 2017-02-06 02:32:47
How can I get GHC to dump out the result of TH splices?
dramforever 2017-02-06 02:33:06
-ddump-splices
dramforever 2017-02-06 02:33:42
merijn: ^
merijn 2017-02-06 02:33:52
dramforever: thanks
dramforever 2017-02-06 02:36:51
You can probably also just (error (pprint blah)) in the middle of nowhere if you want
dramforever 2017-02-06 02:37:12
I've used this a few times
ongy 2017-02-06 02:37:35
afaik you can printLn in TH. but ddump-slices is pretty nice
dramforever 2017-02-06 02:37:53
yes you can
dramforever 2017-02-06 02:38:15
but 'error' can be used anywhere, so I just 'error' the input when I feel stuck
dramforever 2017-02-06 02:38:33
And get an example input back
merijn 2017-02-06 02:38:36
ongy: It's not my TH code
dramforever 2017-02-06 02:38:43
oh
ongy 2017-02-06 02:38:44
ah, that makes it harder
dramforever 2017-02-06 02:38:56
merijn: you can call other people's code in Q
merijn 2017-02-06 02:39:18
dramforever: no, I mean, I'm just calling some TH code in my module and want to know wtf it was generating
dramforever 2017-02-06 02:39:42
ok fair enough
dramforever 2017-02-06 02:39:58
I guess the fact that I'm writing TH drove me into the wrong direction
merijn 2017-02-06 02:40:54
dramforever: I'm using persistent and I'm pretty sure there's a simple way to do what I want, but I can't tell from the docs, so the sane solution is to look at wtf it's generating
dramforever 2017-02-06 02:41:05
:)
merijn 2017-02-06 02:41:11
...
merijn 2017-02-06 02:41:14
Or maybe not...
merijn 2017-02-06 02:41:25
Can I somehow redirect the output of dumpsplices to a file?
merijn 2017-02-06 02:42:03
Because it's more than my scrollback can store >.>
dramforever 2017-02-06 02:43:17
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/debugging.html#ghc-flag--ddump-to-file
dramforever 2017-02-06 02:44:07
merijn: do you happen to use gnome-terminal?
dramforever 2017-02-06 02:44:55
Anyway, there could be a way to get infinite scrollback because that's hardly a problem for modern computers running graphical terminal emulators