Skip to content

Instantly share code, notes, and snippets.

@cutsea110
Created July 26, 2012 09:16
Show Gist options
  • Save cutsea110/3181160 to your computer and use it in GitHub Desktop.
Save cutsea110/3181160 to your computer and use it in GitHub Desktop.
:t zがダメだけど、D (X "123") 123 (1::Y)やD (X "123") 123 (X "456")ではデータ構築可能
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
module Test where
data X = X String
deriving Show
type Y = Int
class Z a where
instance Z X
instance Z Y
data D = forall a. (Show a, Z a) => D { x :: X
, y :: Y
, z :: a
}
-- deriving Show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment