You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instances declared with StandaloneDeriving are not recognized by withStatic, and they don't get their static version defined. The following program does not compile (missing instance for (Static (Show D))).
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StaticPointers #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# Language TemplateHaskell #-}
importControl.Distributed.ClosureimportControl.Distributed.Closure.THimportData.TypeabledataD=Dderiving (Typeable)
withStatic [d|
deriving instance Show D
|]
showC::foralla. (Typeablea, Static (Showa)) =>Closurea->String
showC a = unclosure $ static (\Dict->show)
`cap` (closureDict ::Closure (Dict (Showa)))
`cap` a
main::IO()
main =doputStrLn$ showC $ static D
Neither does withStatic work with derived instances
withStatic [d|
data D = D
deriving (Typeable, Show)
|]
-- Static (Show D) doesn't get defined
As a result, there is no way to auto-generate static versions of instances with default implementations.
The text was updated successfully, but these errors were encountered:
Instances declared with
StandaloneDeriving
are not recognized bywithStatic
, and they don't get their static version defined. The following program does not compile (missing instance for (Static (Show D))
).Neither does
withStatic
work with derived instancesAs a result, there is no way to auto-generate static versions of instances with default implementations.
The text was updated successfully, but these errors were encountered: