Currently, you can use mkMessage like this.
mkMessage "App" "messages" "en"
It will ultimately produce Haskell code like this.
data AppMessage
= MsgFoo {}
| MsgBar {}
-- etc…
instance RenderMessage App AppMessage where
renderMessage _ ((:) msg _) MsgFoo {} | msg == pack "en" = pack ("Foo" :: String)
renderMessage _ ((:) msg _) MsgBar {} | msg == pack "en" = pack ("Bar" :: String)
-- etc…
Similar to how mkYesodSubData can parse out typeclass contexts and type variables, I think mkMessage should support something like this.
mkMessage "(MyClass master) => SubApp master" "messages" "en"
It should produce Haskell code like this.
data SubAppMessage
= MsgFoo {}
| MsgBar {}
-- etc…
instance (MyClass master) => RenderMessage (SubApp master) SubAppMessage where
renderMessage _ ((:) msg _) MsgFoo {} | msg == pack "en" = pack ("Foo" :: String)
renderMessage _ ((:) msg _) MsgBar {} | msg == pack "en" = pack ("Bar" :: String)
-- etc…
Currently, this fails to compile with the following error.
Illegal type constructor or class name: ‘(MyClass master) => SubApp masterMessage’
When splicing a TH declaration:
data (MyClass master) => SubApp masterMessage
= MsgFoo {}
| MsgBar {}
Currently, you can use
mkMessagelike this.It will ultimately produce Haskell code like this.
Similar to how
mkYesodSubDatacan parse out typeclass contexts and type variables, I thinkmkMessageshould support something like this.It should produce Haskell code like this.
Currently, this fails to compile with the following error.