daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest May 16th, 2018 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-# LANGUAGE DataKinds, GADTs, UndecidableInstances, TypeFamilies #-}
  2.  
  3. data Nat = Z | S Nat
  4.  
  5. type family Infinite :: Nat where Infinite = S Infinite
  6.  
  7. data Vec (n :: Nat) where VZ :: Vec Z ; VS :: Vec n -> Vec (S n)
  8.  
  9. x :: Vec Infinite
  10. x = VS x
  11.  
  12. main = main
  13.  
  14. {-
  15. A.hs:10:5: error:
  16.     • Reduction stack overflow; size = 201
  17.       When simplifying the following type: Infinite
  18.       Use -freduction-depth=0 to disable this check
  19.       (any upper bound you could choose might fail unpredictably with
  20.        minor updates to GHC, so disabling the check is recommended if
  21.        you're sure that type checking should terminate)
  22.     • In the expression: VS x
  23.       In an equation for ‘x’: x = VS x
  24.    |
  25. 10 | x = VS x
  26.    |     ^^^^
  27. -}
RAW Paste Data
Top