0

Here is the code

module Main where

import Prelude

twice1 f = f . f

transform :: Int -> Int
transform n = n + 1

apply1 x = (twice1 transform) x

I have an error

  Could not match type

    Record

  with type

    Function Int

What's wrong? (you can try code here http://try.purescript.org)

enter image description here

srghma
  • 4,770
  • 2
  • 38
  • 54

1 Answers1

2

PureScript uses the dot . for accessing record fields, as in:

r = { a: 42, b: "what?!" }
fourtyTwo = r.a

The function composition operator in PureScript is <<< (or >>> for left-to-right composition), for example:

twice1 f = f <<< f
Fyodor Soikin
  • 78,590
  • 9
  • 125
  • 172