- Open src/Main.hs for editing.
- Add a new data type Func a b to represent the function f :: a -> b:
newtype Func a b = Func (a -> b)
- Add a compose function. The compose function takes in two functions and composes them together by giving an output of the first function to the next one:
compose :: Func a b -> Func b c -> Func a c compose (Func f) (Func g) = Func (g . f)
- Now, add a apply function; this takes our data type Func and applies an argument to it:
apply :: Func a b -> a -> b apply (Func f) a = f a
- Now, define a data type called Fix; it takes a function as an argument and tries to recursively define it by applying itself to the function:
newtype Fix f = Fix (f (Fix f))
- Now, define a type Ghost; it takes ...