News for hackers. Stuff that matters.
Re:Contracts For CoffeeScript by AlexeyMK on Tuesday August 30, 2011 @09:42AM (#2941382)
Higher order functions:

  f :: ((Num) -> Bool, Num) -> Bool 
The type of f is not particularly obvious to me; instinctively, it could either be:

1. A function that takes (a function from Num to [Bool, Num]) and returns Bool, or

2. A function that takes (a function from Num to Bool) and a Num, and returns a Bool.

Given enough time, I'm going to guess 2, but this makes CoffeeScript's destructing assignment, IE

  [a, b] = func()
feel less 'first class'. Is this a serious ambiguity, or just me not having enough experience with precedence in CoffeeScript/functional languages?
Re:Contracts For CoffeeScript by dherman on Tuesday August 30, 2011 @10:32AM (#2941578)
No ambiguity; if you put brackets around it you get a tuple (really, an array of fixed elements), and without brackets, the comma is part of the function signature. If you wanted to express your interpretation #1 you'd write:

    f :: ((Num) -> [Bool, Num]) -> Bool
Dave