0

I'd like to quickly and correctly reduce functions to point free form in Haskell. I'd prefer to produce fairly readable outcomes. How should I go about this?

AndrewC
  • 32,300
  • 7
  • 79
  • 115
sof
  • 9,113
  • 16
  • 57
  • 83

2 Answers2

11

There is actually a program called "pointfree"

Do this

cabal install pointfree

then this at the command line

> pointfree "\x -> x+1"

 (1 +)

Warning- although some pointfree outcomes are wonderful, others are pretty scary....

jamshidh
  • 12,002
  • 17
  • 31
4

The Haskell wiki covers tools for pointfree refactoring here. It mainly covers Lambdabot, an IRC bot that does pointfree and pointful refactoring:

@pl \x y -> EQ == compare x y
((EQ ==) .) . compare

[1] Example from http://ircbrowse.net/browse/haskell?id=19908612&timestamp=1421726397#t1421726397

MaxGabriel
  • 7,617
  • 4
  • 35
  • 82