{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE TemplateHaskell #-}
module Types (CatName(..), Category(..), ViewAPI(..), View(..), ViewPref(..), VPEntry(..)) where
import Data.List (find)
import GHC.Prim (Constraint)
type family C a ∷ Constraint
type instance C a = (Eq a, Show a)
data CatName
= Graph
| Dag
| Set
deriving (Eq, Ord, Show, Read)
class C (ViewName cn) ⇒ Category (cn ∷ CatName) where
----- site of GHC 7.10.2 failure
data ViewName cn ∷ *
instance Category 'Graph where
data ViewName 'Graph = SideGraph | DownGraph deriving (Eq, Show)
instance Category 'Set where
data ViewName 'Set = Grid | List deriving (Eq, Show)
class (Category cn) ⇒ ViewAPI (cn ∷ CatName) (vn ∷ ViewName cn) where
$(return [])
instance ViewAPI 'Set ('Grid ∷ ViewName cn) where
----- site of the "nokinds" failure
This fails, but it looks right to me: