Skip to content

Instantly share code, notes, and snippets.

@maoe
Forked from cutsea110/Test.hs
Created July 26, 2012 10:22
Show Gist options
  • Save maoe/3181377 to your computer and use it in GitHub Desktop.
Save maoe/3181377 to your computer and use it in GitHub Desktop.
てすと
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE RankNTypes #-}
module Test where
data X = X String
deriving Show
type Y = Int
class Z a where
zed :: a
instance Z X where
zed = X "zed"
instance Z Y where
zed = 0
data D = D { x :: X
, y :: Y
, z :: forall a. (Show a, Z a) => a
}
{-
*Test> :load "/home/cutsea110/devel/haskell/metadata/Test.hs"
[1 of 1] Compiling Test ( /home/cutsea110/devel/haskell/metadata/Test.hs, interpreted )
/home/cutsea110/devel/haskell/metadata/Test.hs:18:17:
Can't make a derived instance of `Show D':
Constructor `D' must have a Haskell-98 type
Possible fix: use a standalone deriving declaration instead
In the data type declaration for `D'
Failed, modules loaded: none.
Prelude> :t D (X "Hello") 123 zed
D (X "Hello") 123 zed :: D
-}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment