News for hackers. Stuff that matters.
Re:“Mostly functional” programming does not work by GregBuchholz on Sunday April 27, 2014 @10:42AM (#7655241)
>For instance, in Haskell a value is a value. If I have a value of type Integer then it definitely exists;

    x,y::Integer
    x = x + 1
    y = undefined
Re:“Mostly functional” programming does not work by dllthomas on Sunday April 27, 2014 @11:31AM (#7655444)
That's an important point, but since you can't test for undefined-ness it's not quite the same thing as carrying around something that's actually a Maybe Int but just hopes you'll check before implicitly using fromJust everywhere.
Re:“Mostly functional” programming does not work by GregBuchholz on Sunday April 27, 2014 @02:00PM (#7656045)
We just don't want to forget that exceptions and termination are effects, and that Haskell isn't perfectly pure...

    a,b::Integer
    a = div 1 0
    b = sum [1..]
Re:“Mostly functional” programming does not work by dllthomas on Sunday April 27, 2014 @02:56PM (#7656261)
Certainly the case.
Re:“Mostly functional” programming does not work by Dewie on Sunday April 27, 2014 @03:17PM (#7656356)
If you want to avoid partial functions, I guess you would use Safe Haskell.
Re:“Mostly functional” programming does not work by dllthomas on Sunday April 27, 2014 @03:35PM (#7656461)
AFAIK, Safe Haskell doesn't do that. Am I missing something?
Re:“Mostly functional” programming does not work by Dewie on Monday April 28, 2014 @01:37AM (#7658365)
You're probably right. I can't find any mention of enforcing total functions.
Re:“Mostly functional” programming does not work by swift on Sunday April 27, 2014 @05:29PM (#7656986)
Probably you mean the 'safe' package.
Re:“Mostly functional” programming does not work by gnuvince on Sunday April 27, 2014 @11:33AM (#7655455)
`undefined` is used as a placeholder for yet to be written code; since you cannot do anything meaningful with it, it is never used in practice.