https://github.com/Helium4Haskell/lvm
Raw File
Tip revision: a516e95b66e989f1364567e9b4f3292266659d08 authored by Hage, J. (J) on 24 August 2019, 08:00:47 UTC
Getting rid of pesky compile time warnings
Tip revision: a516e95
lift.core
module Lift where {
-- example from Mark Jones to test lambda-lifting
lift1 = let f x y = let const x y = x
                        g z  = let hz = h z in const hz x
                        h z  = let gz = g z in const y gz
                        in g 3
        in f 2 1;   -- == 1


-- test passing function with free vars
lift2 = let liftfv fv = let const x y   = x
                            constfv x y = const y fv
                            apply y f x = f x y
                        in apply 1 constfv 0
        in liftfv 3;  --== 1 (not 0!)


-- examples from Johnson
lift3 = let i   = 0
            f x = f i
        in f i; -- does not terminate


-- hard for the renamer
lift4a = let x   = 1
             f y = x
             g y = f x
         in g f; -- = 1

-- nice for the renamer
lift4b = let a = 1
             b = 2
             f y = a
             g z = f b
        in g f; -- = 1

--lift5 = let ones = @1 1 ones in ones;
}
back to top