Closed jezen closed 1 month ago
Currently, you can use mkMessage like this.
mkMessage
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.
mkYesodSubData
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
mkMessage
like this.It will ultimately produce Haskell code like this.
Similar to how
mkYesodSubData
can parse out typeclass contexts and type variables, I thinkmkMessage
should support something like this.It should produce Haskell code like this.
Currently, this fails to compile with the following error.