Sunday, November 8, 2009

Clean, Sections, Partial Application

Got this one slightly wrong:

http://www.haskell.org/pipermail/haskell-cafe/2009-November/068820.html

Unhappy...


module nonsense

import StdEnv



nonsense = map (^ 2)

Start = nonsense [1,2,3]

Error [nonsense.icl,7,]: ^ first argument of infix operator missing



Happy...



module nonsense

import StdEnv



nonsense = map (flip (^) 2)

Start = nonsense [1,2,3]

"nonsense"
flip :: !.(.a -> .(.b -> .c)) .b .a -> .c
flip :: !.Int !.Int -> Int
nonsense :: .([.Int] -> .[Int])
Start :: .[Int]



Clean can partially apply functions (of course!) but it doesn't appear to support sectioning infix operators. Arrow maniacs might be concerned...

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.