Changes between Version 8 and Version 9 of Language/VersusHaskell

Show
Ignore:
Timestamp:
06/17/10 04:05:57 (4 years ago)
Author:
benl (IP: 129.94.242.38)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Language/VersusHaskell

    v8 v9  
    55These are some syntactic differences that tend to trip up Haskell programmers when they first start with Disciple. 
    66 
    7  * Disciple uses strict / call-by-value as the default evaluation order. This implies that bindings in let and where expressions must be written in dependency order. For example, you can write: 
     7=== Evaluation Order === 
     8Disciple uses strict / call-by-value as the default evaluation order. This implies that bindings in let and where expressions must be written in dependency order. For example, you can write: 
    89 
    9    {{{ 
     10 {{{ 
    1011fun :: Int -> Int 
    1112fun x = x + z 
    1213 where  y = g x 
    1314        z = 3 + y 
    14    }}} 
     15 }}} 
    1516 
    16  but not: 
     17but not: 
    1718 
    18   {{{ 
     19 {{{ 
    1920fun :: Int -> Int 
    2021fun x = x + z 
    2122 where  z = 3 + y 
    2223        y = g x 
    23   }}} 
    24  This doesn't work because the bindings for {{{y}}} and {{{z}}} are in the "wrong" order. 
     24 }}} 
    2525 
    26  For {{{let}}} and {{{where}}} expressions, all the bindings are evaluated in-order, before moving to the body. 
     26This doesn't work because the bindings for {{{y}}} and {{{z}}} are in the "wrong" order. 
    2727 
    28  * We use {{{(.)}}} for projection instead of function composition. If you want to compose two functions then use {{{($)}}}, or suggest a good replacement for `(.)` on the mailing lists. 
     28For {{{let}}} and {{{where}}} expressions, all the bindings are evaluated in-order, before moving to the body. 
    2929 
     30=== The (.) operator === 
     31We use {{{(.)}}} for projection instead of function composition. If you want to compose two functions then use {{{($)}}}, or suggest a good replacement for `(.)` on the mailing lists. 
     32 
     33=== Death to [Char] === 
     34In the Disciple prelude, strings are defined using an append-list of bytestrings. This provides sane complexities to the common operations of constructing and printing strings, with respect to the regular Haskell ones. For this reason you need to use the string append operator `(%)` to append lists, instead of the list append operator `(++)`. If you really want a list of characters then use `charListOfString :: String -> [Char]` defined in `Data.List`. 
     35 
     36=== No Dictionary Passing === 
     37Dictionary passing for type classes isn't implemented yet, but we plan to in the medium term (within 12 months). You can still define new classes and instances, but each method call must be resolved to its instance at the point of use. In practice this means that you can't write functions with class contexts. For example, this is ok: 
     38 
     39{{{ 
     40showTwoInts :: (Int, Int)  -> String 
     41showTwoInts (x, y) = "you've got a " % show x % " and a " % show y 
     42}}} 
     43 
     44but this doesn't work: 
     45 
     46{{{ 
     47showTwoThings :: Show a => (a, a) -> String 
     48showTwoThings (x, y) = "you've got a " % show x % " and a " % show y  
     49}}} 
     50 
     51 
     52 
     53 
     54