Haskell help

  • Thread starter Dragonfall
  • Start date
  • #1
1,028
4

Main Question or Discussion Point

I want do the Haskell equivalent of SML-like "return a function"

fun foo x = fn x=>x+1

How do I do this in Haskell?
 

Answers and Replies

  • #2
12
0
Code:
foo :: a -> Int -> Int
foo x = \x -> x+1
This can be written more concisely as:

Code:
foo = const (+1)
 
  • #3
1
0
Hi,People! I need to define in haskell a function which ignore all doublings . For example if i type a string "abaacccdee" in the end i get the string "abacde".
 

Related Threads for: Haskell help

Replies
1
Views
1K
  • Last Post
Replies
2
Views
1K
Replies
0
Views
2K
Top