Search Haskell Channel Logs

Tuesday, January 31, 2017

#haskell channel featuring jle`, steve___, kadoban, MP2E, jchia_1, mrkgnao, and 5 others.

Squarism 2017-01-31 17:47:15
theres no easy way to create a singleton list wo using [...]
Squarism 2017-01-31 17:47:16
?
kadoban 2017-01-31 17:48:00
pure, return, or what's wrong with using [a] ?
jle` 2017-01-31 17:48:22
> pure 10 :: [Int]
lambdabot 2017-01-31 17:48:24
[10]
jchia_1 2017-01-31 17:52:08
Where can I go to learn what exactly exceptions are in Haskell from first principles? Neither modules like Control.Monad.Error nor packages like safe-exceptions, nor any of the schools of thoughts about how exceptions should be used, nor how async exceptions should handled, per se, but mainly the meaning of exceptions, async exceptions, masks, they relationship to one another and to the RTS, and what they mean for the behavior of a program?
jchia_1 2017-01-31 17:52:56
once i understand these, i can understand those modules and packages in their context
jchia_1 2017-01-31 17:54:12
i know what it means in another language like C++ to catch and throw. in haskell, it seems it's not so straight-forward given the existence of 'async' and 'mask' and I'm not sure what those mean exactly to program behavior.
jle` 2017-01-31 17:56:04
jchia_1: for me, it was that exceptions chapter in Parallel & Concurrent haskell
Squarism 2017-01-31 17:56:16
kadoban, sometimes you want to cram a big expression in that that list constructor.. then it just gets messy with matching brackets
Jello_Raptor 2017-01-31 17:56:46
Hmm, do any of you know if it's possible to get TypeApplication to play nicely with infix operators? or failing that a suggestion that lets me get a vaguely nice syntax for my edsl? http://lpaste.net/351856 line 4 and 9 are what I want, but line 38 is the only thing that works.
Squarism 2017-01-31 17:56:48
...sure, one could argue, defenine the element first. But it could be good to know a non infix(?) version
jchia_1 2017-01-31 17:56:50
jle`: OK, I'll look that up.
jle` 2017-01-31 17:57:48
jchia_1: http://chimera.labs.oreilly.com/books/1230000000929/ch08.html#sec_exceptions
Jello_Raptor 2017-01-31 17:58:56
Right now, it seems like TemplateHaskell is the only way to get something approximating record syntax and that's horrible overkill for what I'm aiming to do
steve___ 2017-01-31 18:00:04
:q
kadoban 2017-01-31 18:01:53
Squarism: Well, pure or (:[]) then ?
geekosaur 2017-01-31 18:02:04
Jello_Raptor, I don';t think anything requires TH for this; it's a convenience to auto-derive typeclass instances
Squarism 2017-01-31 18:02:22
kadoban, thanks
Jello_Raptor 2017-01-31 18:09:35
geekosaur: I'm not looking for an actual record syntax, it's just that my edsl uses a lot of record-like structures and I want a nice looking way to enter record-like data. I've updated the paste with some examples http://lpaste.net/351856
Jello_Raptor 2017-01-31 18:12:37
barring that, some way to get nice looking for record-like things would be nice
Squarism 2017-01-31 18:35:43
running stack to compile it seems cpu utilization is mostly 100% on 1 and like 2-4% on the 3 rest cores. Does one need to do something to get a better spread/utilization?
Squarism 2017-01-31 18:36:01
core
Squarism 2017-01-31 18:36:03
that is
Squarism 2017-01-31 18:36:34
100% on 1, just barely alive on the 3 rest
qmm 2017-01-31 18:36:39
what is the difference between Float, Double, and Rational?
Squarism 2017-01-31 18:37:55
rational numbers are integer/integer right?
Squarism 2017-01-31 18:38:44
float and double are just different precision - float beeing of less
Jello_Raptor 2017-01-31 18:38:45
yup
Jello_Raptor 2017-01-31 18:39:33
Squarism: also yes, with the caveat that there's more precision the closer you are to 0 with floating point.
Squarism 2017-01-31 18:39:55
oh ok, didnt know that
MP2E 2017-01-31 18:40:04
yep. Floating point corresponds to a 32-bit floating point value, Double corresponds to a 64-bit floating point value, and Rational represents it in fractional form using integers
MP2E 2017-01-31 18:40:16
float*
MP2E 2017-01-31 18:40:46
Float and Double would usually be faster than Rational, but may (read: most likely will) lose some precision
Squarism 2017-01-31 18:41:57
Jello_Raptor, but isnt the mantisa larger for double - regardless of exponent?
mrkgnao 2017-01-31 18:44:47
I wrote a function with this signature:
mrkgnao 2017-01-31 18:44:49
instAt :: Int -> Lens' VMState AsmInst