Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WTF, Haskell?

Name: Anonymous 2012-01-08 2:05


Prelude> (+) 1 2*3
9
Prelude> (+) 1*3 2

<interactive>:1:0:
    No instance for (Num (t -> t))
      arising from a use of `*' at <interactive>:1:0-8
    Possible fix: add an instance declaration for (Num (t -> t))
    In the expression: (+) 1 * 3 2
    In the definition of `it': it = (+) 1 * 3 2

<interactive>:1:6:
    No instance for (Num (t1 -> t -> t))
      arising from the literal `3' at <interactive>:1:6-8
    Possible fix: add an instance declaration for (Num (t1 -> t -> t))
    In the second argument of `(*)', namely `3 2'
    In the expression: (+) 1 * 3 2
    In the definition of `it': it = (+) 1 * 3 2
Prelude>

Name: Anonymous 2012-01-09 8:52

>>14
CbV and CbN have both advantages and disadvantages. Neither is a silver bullet.
CbN has only useless mathematical "advantages", which are harmful in pracitce if you aint into theorem proving. Mathematics isn't know for intuitivity, while CbV is pretty intuitive and corresponds to layman view of the world.

It's not that rich.

Lisp                       | Haskell
---------------------------|----------------------------------------------------
Prefix notation.           | Prelude> let fac 1 = 1; fac n = n * fac n-1
                           | Prelude> fac 4
                           | *** Exception: stack overflow
                           |
                           | Prelude> let f 1 = 1; f n = ((*)(n)((f) ((-) n 1)))
                           | Prelude> ((f) 4)
                           | 24

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List