mroman 2017-02-21 11:45:24
f(f(f(f( never even returns.
mroman 2017-02-21 11:45:43
it provably never returns.
Rembane 2017-02-21 11:45:55
Side effects to the rescue!
dmwit 2017-02-21 11:45:58
mroman: What do you make of my code above that returns despite using that pattern, then?
mroman 2017-02-21 11:46:20
the fib?
dmwit 2017-02-21 11:46:24
yes
Axman6 2017-02-21 11:46:56
mroman: that depends on what f is
dmwit 2017-02-21 11:47:13
mroman: Or even more simply,
dmwit 2017-02-21 11:47:28
> let f = (1:); x = f x in x
lambdabot 2017-02-21 11:47:30
[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
Axman6 2017-02-21 11:47:31
seems you're talking about a specific f, but it si not the case in general. a trivial example is f = const ()
dmwit 2017-02-21 11:47:49
Oh, I like `const`.
Axman6 2017-02-21 11:47:50
it is true if f is strict in that argument
Cale 2017-02-21 11:48:01
let primes = 2 : filter isPrime [3,5..]; isPrime n = all (\p -> n `mod` p /= 0) (takeWhile (\p -> p*p <= n) primes) in primes
Cale 2017-02-21 11:48:03
> let primes = 2 : filter isPrime [3,5..]; isPrime n = all (\p -> n `mod` p /= 0) (takeWhile (\p -> p*p <= n) primes) in primes
mroman 2017-02-21 11:48:08
if you chain an infinite amount of f(f(f(f(f(...)
lambdabot 2017-02-21 11:48:08
[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,...
mroman 2017-02-21 11:48:13
then it doesn't return.
dmwit 2017-02-21 11:48:16
I wonder what OCaml would make of `fix const`.
Cale 2017-02-21 11:48:22
mroman: How do you know that?
Cale 2017-02-21 11:48:39
mroman: The outermost f might finish immediately without needing to examine its argument
Axman6 2017-02-21 11:48:59
> let f = const () in f (f(f(f(f(f(f)))))
lambdabot 2017-02-21 11:49:05
lambdabot 2017-02-21 11:49:05
parse error (possibly incorrect indentation or mismatched brackets)
mroman 2017-02-21 11:51:00
Cale: good point.
dmwit 2017-02-21 11:55:23
At a high level: I think you want to support user-written recursion combinators. These are very useful e.g. for implementing memoization libraries and the like. But if you allow those, then you allow `fix`; and if you allow `fix` and polymorphism, then you allow `fix id`; and if you have `fix id` then you have `undefined`.
hpc 2017-02-21 11:59:23
clearly polymorphism is to blame
tommd 2017-02-21 12:10:52
I'm trying to make heads or tails of `HookedBuildInfo` in Cabal. Does anyone have a non-source-code-dive explanation?
tommd 2017-02-21 12:11:25
The short of it is I want to change the BuildInfo, but in preConf the `fst` element is `Nothing`.
bollu 2017-02-21 12:17:30
someone on #haskell was asking about applicativeDo?
bollu 2017-02-21 12:17:40
I was reading the paper, and it says: "A shortcoming of our design is that the check for return or pure is purely syntactic, and is easily defeated. For example, even return $ x or let p = pure in p x are not recognised"
bollu 2017-02-21 12:17:52
I thought they would be interested as to why the return $ x didn't work :)
lyxia 2017-02-21 12:22:37
ph88^: ^
ph88^ 2017-02-21 12:23:03
hi lyxia
ph88^ 2017-02-21 12:23:35
ah yes ok :P
alviprofluvium 2017-02-21 12:28:45
:q
codedmart 2017-02-21 12:37:28
Can you prepend a line to a file?
fresheyeball 2017-02-21 12:40:52
codedmart: yes
codedmart 2017-02-21 12:41:26
fresheyeball: I guess I know you can, but I mean is there already a func for it somewhere I am missing?
fresheyeball 2017-02-21 12:43:25
not that I know of
fresheyeball 2017-02-21 12:43:32
I think the easiest would be to read and then write