blob: 78b54958586d1d95fa732e803da6073029509a46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
-- Check that splicing in a quoted declaration has the same effect as
-- giving the declaration directly.
{-# LANGUAGE TemplateHaskell, TypeData, GADTs #-}
module TD_TH_splice where
import Data.Kind (Type)
-- splice should be equivalent to giving the declaration directly
$( [d| type data Nat = Zero | Succ Nat |] )
data Vec :: Nat -> Type -> Type where
VNil :: Vec Zero a
VCons :: a -> Vec n a -> Vec (Succ n) a
instance Functor (Vec n) where
fmap _ VNil = VNil
fmap f (VCons x xs) = VCons (f x) (fmap f xs)
|