Last active
July 28, 2016 16:57
-
-
Save harpocrates/617456ef82948a161c26634e9aa3929e to your computer and use it in GitHub Desktop.
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 TypeFamilies #-} | |
-- Subsitute type `x` for type `y` in type `a` | |
-- Works only for type constructors having up to 4 type arguments... | |
type family Substitute x y a where | |
Substitute x y x = y | |
Substitute x y (k a b c d) = k (Substitute x y a) (Substitute x y b) (Substitute x y c) (Substitute x y d) | |
Substitute x y (k a b c) = k (Substitute x y a) (Substitute x y b) (Substitute x y c) | |
Substitute x y (k a b) = k (Substitute x y a) (Substitute x y b) | |
Substitute x y (k a) = k (Substitute x y a) | |
Substitute x y a = a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment