Search Haskell Channel Logs

Friday, February 3, 2017

#haskell channel featuring jle`, shtuka, Lokathor, Jinixt, dramforever, jpgarcia,

Lokathor 2017-02-03 18:56:36
someone said something to me earlier
Lokathor 2017-02-03 18:56:43
but i was asleep for 5 hours
Lokathor 2017-02-03 18:56:51
so it's not in my scrollback
shtuka 2017-02-03 19:13:35
How would you write a Haskell program solving the Einstein riddle https://udel.edu/~os/riddle.html ? It is easy in Prolog.
jle` 2017-02-03 19:15:47
probably could do something similar with list's monad instance maybe
erisco 2017-02-03 19:16:11
jle`, I have something fun to show you in a few minutes :D
jle` 2017-02-03 19:16:19
:o
erisco 2017-02-03 19:19:55
seems my program hangs =\
shtuka 2017-02-03 19:23:20
what does your program do?
erisco 2017-02-03 19:24:07
it defines bounded naturals
shtuka 2017-02-03 19:24:38
natural == {0,1,2,...}?
erisco 2017-02-03 19:24:43
yes
Jinixt 2017-02-03 19:24:53
shtuka: easy, start by implementing prolog in haskell
erisco 2017-02-03 19:24:58
unfortunately it hangs when I ask for maxBound
Jinixt 2017-02-03 19:25:00
:-)
shtuka 2017-02-03 19:25:04
;-)
erisco 2017-02-03 19:25:49
jle`, here it is http://lpaste.net/352077
erisco 2017-02-03 19:26:47
type checks but something goes awry
erisco 2017-02-03 19:27:22
maybe sPred' doesn't do what I think it does
Jinixt 2017-02-03 19:31:07
shtuka: i'm no expert, but my intuition would be to create a (lazy) list of all possibilities, have another list of the conditions, and just strike off possibilities from the front when they violate a condition
Jinixt 2017-02-03 19:31:18
should essentially be the same as what you do in prolog
erisco 2017-02-03 19:31:36
well it seems to run fine in isolation... sPred' that is
erisco 2017-02-03 19:31:43
maybe one of the proofs does not terminate? hrm
shtuka 2017-02-03 19:32:15
Jinixt: ok. would this be as efficient as the Prolog program?
erisco 2017-02-03 19:33:03
I suppose I do not prove that Pred b is actually the max or that a is actually the min, heh
erisco 2017-02-03 19:33:21
I just did enough to prove that they're okay to put in Range
dramforever 2017-02-03 19:33:28
shtuka: We don't have 'the' Prolog program :)
shtuka 2017-02-03 19:34:33
http://swish.swi-prolog.org/example/houses_puzzle.pl :)
erisco 2017-02-03 19:37:41
alright interesting, it is lneqSucc b that hangs
Jinixt 2017-02-03 19:39:05
i'll make an attempt at the puzzle
jpgarcia 2017-02-03 19:39:23
Is there a way to enable ghc extensions at the middle of a file?
dramforever 2017-02-03 19:39:39
shtuka: it's a bit difficult to say, actually
dramforever 2017-02-03 19:40:10
because Prolog can do symbolic manipulation, like how you have 'Hs', '_' all over your code
jpgarcia 2017-02-03 19:40:11
I want to do literate programming, and call extensions pragmas when i need them, not at the start of the file
dmiles 2017-02-03 19:40:34
https://rosettacode.org/wiki/Zebra_puzzle
dramforever 2017-02-03 19:40:37
it's not going to happen automatically in Haskell
dmiles 2017-02-03 19:40:45
(there is a Haskel version there)
dmiles 2017-02-03 19:41:11
two Haskell versions
erisco 2017-02-03 19:44:14
jle`, another problem with Haskell is proofs can be wrong because they don't terminate =\
erisco 2017-02-03 19:44:26
bottom proves all!
erisco 2017-02-03 19:44:37
the null of proofs
jle` 2017-02-03 19:44:46
:/
erisco 2017-02-03 19:45:04
I am guessing there is an error in type-natural