[Haskell-cafe] Order of Declaration
Stefan O'Rear
stefanor at cox.net
Sat Sep 29 13:22:51 EDT 2007
On Sat, Sep 29, 2007 at 12:05:01PM -0500, Derek Elkins wrote:
> On Sat, 2007-09-29 at 17:58 +0100, PR Stanley wrote:
> > Hi
> > in C type languages a function must be declared before its application.
> > Would I be right in thinking that this isn't the case in Functional languages?
> > For example:
> > transmit :: String -> String
> > transmit = decode . channel . encode
> > channel :: [[Int]] -> [[Int]]
> > channel = id
>
> It's not the case in Haskell. Not only is the above valid, but so is:
>
> transmit = decode . channel . encode
>
> channel :: [[Int]] -> [[Int]]
>
> transmit :: String -> String
>
> channel = id
It is, however, the case in other functional languages like ML.
Declaration-before-use, as a design decision, is independant of
functionality.
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070929/b25f082a/attachment.bin
More information about the Haskell-Cafe
mailing list