1
Fork 0
tagless-final-parsing/leibniz-proof/app/Main.hs

31 lines
732 B
Haskell
Raw Normal View History

2021-12-20 13:16:50 +00:00
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE TypeOperators #-}
module Main where
2022-01-12 11:51:56 +00:00
import Data.Eq.Type (refl, (:=) (..))
2021-12-20 13:16:50 +00:00
newtype F1 t b a = F1 {runF1 :: t := (a -> b)}
2022-01-12 11:51:56 +00:00
2021-12-20 13:16:50 +00:00
newtype F2 t a b = F2 {runF2 :: t := (a -> b)}
2022-01-12 11:51:56 +00:00
functionEquality ::
forall a1 a2 b1 b2.
a1 := a2 ->
b1 := b2 ->
(a1 -> b1) := (a2 -> b2)
2021-12-20 13:16:50 +00:00
functionEquality
2022-01-12 11:51:56 +00:00
(Refl s1) -- s1 :: forall c. c a1 -> c a2
(Refl s2) -- s2 :: forall c. c b1 -> c b2
=
runF2 -- (a1 -> b1) := (a2 -> b2)
. s2 -- F2 (a1 -> b1) a2 b2
. F2 -- F2 (a1 -> b1) a2 b1
. runF1 -- (a1 -> b1) := (a2 -> b1)
. s1 -- F1 (a1 -> b1) b1 a2
. F1 -- F1 (a1 -> b1) b1 a1
$ refl -- (a1 -> b1) := (a1 -> b1)
2021-12-20 13:16:50 +00:00
main :: IO ()
main = putStrLn "Hello, Haskell!"