Skip to content

Instantly share code, notes, and snippets.

@StevenXL
Created April 3, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenXL/1611371cafe4de4323f0ec4dda8d007a to your computer and use it in GitHub Desktop.
Save StevenXL/1611371cafe4de4323f0ec4dda8d007a to your computer and use it in GitHub Desktop.
Compiler Error with Symbol
{-# 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