Trying to implement the PRF vararg combinators in Haskell by using Typeclass trick.
PRF_General.hs
โ generic implementation that have a lot of problem with ambiguity of typeclass parameters.PRF_Int.hs
โ similar to generic implementation except for some combinators always returnInt
that reduces some problem parameters of typeclasses.
-- dec
dec :: Int -> Int
dec = c2 (r z prj1) prj1' prj1'
where
prj1' = prj1 :: Int -> Int
-- add
add :: Int -> Int -> Int
add = r prj1 (c inc (prj2 :: Int -> Int -> Int -> Int))
-- mul
mul :: Int -> Int -> Int
mul = r z mulg
where
prj2', prj3' :: Int -> Int -> Int -> Int
prj2' = prj2
prj3' = prj3
mulg = c2 add prj2' prj3'