Created
April 3, 2019 13:40
-
-
Save StevenXL/1611371cafe4de4323f0ec4dda8d007a to your computer and use it in GitHub Desktop.
Compiler Error with Symbol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module Test where | |
import GHC.TypeLits (symbolVal, KnownSymbol) | |
import Data.Proxy (Proxy(..)) | |
newtype s >> a = Named a | |
data HRec xs where | |
HREmpty :: HRec '[] | |
HRCons :: (s >> a) -> HRec xs -> HRec (s >> a ': xs) | |
instance Show (HRec '[]) where | |
show :: HRec '[] -> String | |
show _ = "HREmpty" | |
instance (KnownSymbol s, Show a, Show (HRec xs)) => Show (HRec ((s >> a) ': xs)) where | |
show :: HRec ((s >> a) ': xs) -> String | |
show (HRCons (Named a) as) = let val = show a | |
key = (symbolVal @s) Proxy | |
in undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment