quchen 2017-02-20 01:45:17
When you start GHCi with -O it complains that this conflicts with --interactive :-/
cocreature 2017-02-20 01:45:49
quchen: after -fobject-code it doesn't complain anymore
quchen 2017-02-20 01:46:15
Woah
mbrock 2017-02-20 01:46:19
I think it does work, thanks. Using cabal repl --ghc-options='-fobject-code -O2'
cocreature 2017-02-20 01:47:16
the main advantage of -fobject-code however is that it reloads significantly faster since it only recompiles a single module instead of all modules
Schrostfutz 2017-02-20 01:47:17
quchen: Thanks, I'll look into that.
quchen 2017-02-20 01:48:15
Schrostfutz: The good news is that once you understand foldl-via-foldr, you probably know everything about foldl/foldr there is to know. :-)
Schrostfutz 2017-02-20 01:48:42
quchen: Haha, question is just in how many weeks that will be :D
cocreature 2017-02-20 01:49:27
working through a solution for foldl-via-foldr is not that hard. coming up with it yourself is really hard (I don't think I've come up with a solution myself)
quchen 2017-02-20 01:50:36
Schrostfutz: I can't recommend evaluating »foldlViaFoldr (+) 0 [1,2,3]« by hand enough. The key is understanding foldr's »fourth parameter«, and once you have that, everything becomes clear.
Cooler 2017-02-20 01:52:03
is there an ide for haskell that lets you click on functions to get their source?
Cooler 2017-02-20 01:52:18
like the source for foldr for instance
Schrostfutz 2017-02-20 01:52:45
quchen: So far I as I understand it the step function does not implement the step but binds the n+1 parameters to n...
quchen 2017-02-20 01:52:48
Cooler: None that I know of. But Lambdabot has lots of common functions in simple notation stored.
quchen 2017-02-20 01:52:51
?src foldr
lambdabot 2017-02-20 01:52:51
foldr f z [] = z
lambdabot 2017-02-20 01:52:51
foldr f z (x:xs) = f x (foldr f z xs)
quchen 2017-02-20 01:53:10
Schrostfutz: Right, the step function uses the excess parameter.
cocreature 2017-02-20 01:53:31
Cooler: I think https://github.com/aloiscochard/codex can do that (it's not an idea but you can integrate tags with at least emacs & vim and probably most other editors)
quchen 2017-02-20 01:53:52
Schrostfutz: foldr f z (x:xs) foo = f x (foldr f z xs) foo
quchen 2017-02-20 01:54:09
The foldr ignores the foo, but the f uses it :-)
quchen 2017-02-20 01:54:24
(Or may use it, rather)
Cooler 2017-02-20 02:02:52
do you need to import something for liftA2?
Cooler 2017-02-20 02:02:58
Control.Applicative?
ski 2017-02-20 02:09:16
@index liftA2
lambdabot 2017-02-20 02:09:17
Control.Applicative
Schrostfutz 2017-02-20 02:10:45
quchen: I think I'm stuck here: http://sprunge.us/HURM The last two steps are likely wrong
Schrostfutz 2017-02-20 02:22:34
quchen: Now I've got it: http://sprunge.us/dBSE Thanks for the help!
Schrostfutz 2017-02-20 02:24:33
So you basically hack the accumulator onto the foldr function. I don't have much experience with haskell yet but this smells for me like bad style since I rely on how the foldr function is implemented such that I can pass the excess parameter to my step parameter, don't I?
Squarism 2017-02-20 02:33:11
After dealing with haskell for 8 months this is my interpretion of haskells deal with IO Monad. Correct me if im wrong. The IO Monad (modelling "an effect") main purposes are - 1. Makes valus from io inaccessible outside the Monad - thus makes it impossible to do io computations wo returning IO values. And further lets 2. provides a single point callback to track interactions with the outside. So, atleast in theory, one can set up an execution that is
Squarism 2017-02-20 02:33:11
completely deterministic.
merijn 2017-02-20 02:34:27
Squarism: Rather relevant: https://blog.jle.im/entry/io-monad-considered-harmful.html
Squarism 2017-02-20 02:34:54
ops should be "And further ... makes IO computations explicit in the type signatures of function"
merijn 2017-02-20 02:35:08
And no, point 2 isn't really (and by that I mean: really isn't) true
merijn 2017-02-20 02:36:44
Squarism: One of the key insights is that in Haskell we distinguish two things: 1) evaluation (which covers the behaviour of Haskell as described in the standard) and 2) execution (which covers IO). The 2nd is unobservable from the first and thus cannot influence the behaviour of how expressions reduce
merijn 2017-02-20 02:37:25
So the thing that makes Haskell pure is that the IO behaviour of execution cannot be observed inside the non-IO expressions that are evaluated
Squarism 2017-02-20 02:38:22
merijn, ah ok. That was a nice summary.
stefR 2017-02-20 02:42:10
hi everyone. In my code I define default value myDefaultList = [] the compiler advise me to define it with explicit type this way myDefaultListForAll :: forall t. [t] whereas a simple myDefaultList :: [a] seems to suffice to satisfy the compiler warning. What is the difference between the two definition ?
merijn 2017-02-20 02:43:54
stefR: Nothing, basically. In basic (as in, no extensions) Haskell ALL type variables implicitly have a "forall" on the left. The forall doesn't normally exist in Haskell, but is used in the underlying theory (and some extensions)
merijn 2017-02-20 02:44:13
stefR: So "myDefaultList :: [a]" is treated, internally as "myDefaultList :: forall a . [a]"