Created
November 7, 2016 13:30
-
-
Save ssaavedra/b5d2e5987fc12f485e9cb84c99740ec6 to your computer and use it in GitHub Desktop.
Haskell and higher-order polymorphism. Intuitionstic logic and type theory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
module Operator | |
where | |
(***) f g (x1, x2) = (f x1, g x2) | |
f :: [a] -> [a] | |
f = snd . splitAt 1 | |
type GType a = ([a], [a]) | |
f' :: [a] -> GType a | |
f' = splitAt 1 | |
g :: [a] -> Int | |
g = length | |
-- Naïve type: | |
-- (???) :: (t -> t1) -> (t, t) -> (t1, t1) | |
type FType c a = c | |
myCoercion :: (f a -> c) -> (f a -> FType c a) | |
myCoercion a = a | |
(???) :: (forall a. f a -> g a) -> (f a, f b) -> (g a, g b) | |
(???) f (x1, x2) = (f *** f) (x1, x2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment