packages feed

hermit-0.7.0.0: examples/new_reverse/Reverse.hs

module Main where

import HList
import Data.Function (fix)

{-# INLINE repR #-}
repR :: ([a] -> [a]) -> ([a] -> H a)
repR f = repH . f

{-# INLINE absR #-}
absR :: ([a] -> H a) -> ([a] -> [a])
absR g = absH . g

rev :: [a] -> [a]
rev []     = []
rev (x:xs) = rev xs ++ [x]

main :: IO ()
main = print $ rev [1..10]

-- useful auxilliary lemma for proving the w/w assumption
{-# RULES "++ []" [~] forall xs. xs ++ [] = xs #-}