Created
April 6, 2018 09:56
-
-
Save Sophia-Gold/9451771ab8a809d4eb131c5c53668aa3 to your computer and use it in GitHub Desktop.
type level iterate
This file contains hidden or 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 #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE KindSignatures #-} | |
| data Nat = Z | S Nat | |
| type family Iterate (n :: Nat) f a where | |
| Iterate Z f a = a | |
| Iterate (S n) f a = f (Iterate n f a) | |
| thing :: Iterate (S (S (S Z))) [] Int | |
| thing = [[[3,4],[2]],[[],[9,9,9]],[]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment