[Haskell-cafe] minor refactoring problem
Stefan Holdermans
stefan at vectorfabrics.com
Tue Nov 29 13:18:50 CET 2011
Martin,
> Quick question: what's the difference between
>
> importFile ed = readfile >=> fromRawFile >=> setEditor ed
>
> and
>
> importFile = readfile >=> fromRawFile >=> setEditor
>
> that the former compiles but the latter doesn't?
Note that, in Haskell, function application has higher priority then any other infix operation. So,
importFile ed = readfile >=> fromRawFile >=> setEditor ed
is the same as
importFile ed = readfile >=> fromRawFile >=> (setEditor ed)
If you write
importFile = readfile >=> fromRawFile >=> setEditor
then this is (via eta expansion) more or less equivalent to
importFile ed = (readfile >=> fromRawFile >=> setEditor) ed
which is clearly not the same as the original definition.
HTH,
Stefan
More information about the Haskell-Cafe
mailing list