Skip to content

Instantly share code, notes, and snippets.

@Lysxia
Created May 10, 2018 22:49
Show Gist options
  • Save Lysxia/d6f76ae009dfb387fd573e89412e34f1 to your computer and use it in GitHub Desktop.
Save Lysxia/d6f76ae009dfb387fd573e89412e34f1 to your computer and use it in GitHub Desktop.
{-# LANGUAGE DataKinds, GADTs, UndecidableInstances, TypeFamilies #-}
data Nat = Z | S Nat
type family Infinite :: Nat where Infinite = S Infinite
data Vec (n :: Nat) where VZ :: Vec Z ; VS :: Vec n -> Vec (S n)
x :: Vec Infinite
x = VS x
main = main
{-
A.hs:10:5: error:
• Reduction stack overflow; size = 201
When simplifying the following type: Infinite
Use -freduction-depth=0 to disable this check
(any upper bound you could choose might fail unpredictably with
minor updates to GHC, so disabling the check is recommended if
you're sure that type checking should terminate)
• In the expression: VS x
In an equation for ‘x’: x = VS x
|
10 | x = VS x
| ^^^^
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment