Re:Swift Functors, Applicatives, and Monads in Pictures
by lmm on Wednesday July 15, 2015 @06:33AM
(#9890590)
Explicit is better than implicit. Does Haskell allow functions to have value parameters that aren't declared?
[ Parent
| on HN ]
Re:Swift Functors, Applicatives, and Monads in Pictures
by TheCoelacanth on Wednesday July 15, 2015 @11:20AM
(#9891745)
Depends what you mean by "not declared". Haskell doesn't require you to provide type signatures, so if you don't put a type signature on a function, you can have parameters that aren't explicitly declared (though they still have an inferred static type, so you could use ghci to see what all the parameters are). If you do put any type signature on the function, then all parameters would have to be included.
Re:Swift Functors, Applicatives, and Monads in Pictures
by lmm on Wednesday July 15, 2015 @11:54AM
(#9891993)
If I make a typo when using a value parameter in a function definition, can I accidentally introduce an extra value parameter?
If I make a typo when using a type parameter in a function definition, can I accidentally introduce an extra type parameter?
Re:Swift Functors, Applicatives, and Monads in Pictures
by TheCoelacanth on Friday July 17, 2015 @09:25AM
(#9902582)
> If I make a typo when using a value parameter in a function definition, can I accidentally introduce an extra value parameter?
No.
> If I make a typo when using a type parameter in a function definition, can I accidentally introduce an extra type parameter?
You couldn't introduce a new concrete type. You could introduce a new type variable, but the type signature would still have to typecheck, so it would difficult to come up with a non-contrived example where that would happen.