Skip to content

Instantly share code, notes, and snippets.

@xgrommx

xgrommx/sem.hs Secret

Last active February 22, 2018 12:16
Show Gist options
  • Save xgrommx/29c2276f9f1c3c27b2e6adaf3a2b9efa to your computer and use it in GitHub Desktop.
Save xgrommx/29c2276f9f1c3c27b2e6adaf3a2b9efa to your computer and use it in GitHub Desktop.
/Users/dstoyano/work/app10/src/FreeNum.hs:32:1: error:
• No instance for (BaseSem
(Data.Functor.Free.ShowHelper AdvSemSignature a))
arising from the superclasses of an instance declaration
• In the instance declaration for
‘AdvSem (Data.Functor.Free.ShowHelper AdvSemSignature a)’
|
32 | deriveInstances ''AdvSem
| ^^^^^^^^^^^^^^^^^^^^^^^^
/Users/dstoyano/work/app10/src/FreeNum.hs:32:1: error:
• Could not deduce (BaseSem
(Data.Functor.Free.LiftAFree AdvSem f a))
arising from the superclasses of an instance declaration
from the context: Applicative f
bound by the instance declaration
at /Users/dstoyano/work/app10/src/FreeNum.hs:32:1-24
• In the instance declaration for
‘AdvSem (Data.Functor.Free.LiftAFree AdvSem f a)’
|
32 | deriveInstances ''AdvSem
| ^^^^^^^^^^^^^^^^^^^^^^^^
/Users/dstoyano/work/app10/src/FreeNum.hs:32:1: error:
• No instance for (BaseSem (Free AdvSem a))
arising from the superclasses of an instance declaration
• In the instance declaration for ‘AdvSem (Free AdvSem a)’
|
32 | deriveInstances ''AdvSem
| ^^^^^^^^^^^^^^^^^^^^^^^^
Failed, no modules loaded.
{-# LANGUAGE TemplateHaskell, TypeFamilies, DeriveFunctor, DeriveFoldable, DeriveTraversable, FlexibleInstances #-}
{-# LANGUAGE LambdaCase, FlexibleContexts, UndecidableInstances #-}
module Sem where
import Data.Functor.Free
import Data.Functor.Foldable
import Data.Functor.Foldable.TH
class BaseSem a where
val :: Int -> a
add :: a -> a -> a
instance BaseSem Int where
val = id
add = (+)
class BaseSem a => AdvSem a where
mul :: a -> a -> a
instance AdvSem Int where
mul = (*)
deriveInstances ''BaseSem
deriveInstances ''AdvSem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment