Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {-# Language GADTs,TypeOperators,PolyKinds,DataKinds,TypeFamilies #-}
  2. data State s a where
  3.  Basecase' :: Basecase s a -> State s a
  4. Nested'   :: Nested s a xs   -> State s a
  5.  
  6. data Basecase s a where
  7.  Stream' :: Stream s a -> Basecase s a
  8. Linear' :: Linear s a -> Basecase s a
  9.  Stack'  :: Stack  s a -> Basecase s a
  10.  
  11. data Stream s a = Stream (a,s)
  12.  
  13. data Linear s a = Linear (a,s) | End a
  14.  
  15. data Stack  s a = Stack  (a,s) | Empty
  16.  
  17. type family Head (xs :: [a]) :: a where
  18. Head (x ': xs) = x
  19.  
  20. data Nested (s :: *) (a :: *) (xs :: [State s a]) where
  21.  Nested :: Int -> Nested s a xs
  22.  
  23. {-
  24.     * Type constructor `State' cannot be used here
  25.         (it is defined and used in the same recursive group)
  26.     * In the kind `[State s a]'
  27.    |
  28. 20 | data Nested (s :: *) (a :: *) (xs :: [State s a]) where
  29.    |                                       ^^^^^
  30. -}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement