带有 purescript-bridge 的多态类型

Polymorphic types with purescript-bridge

我输入了Haskell

newtype Uid a = Uid {uidToText :: Text}
  deriving (Eq, Ord, Show, Data, Typeable, Generic)

使用 purescript-bridgemkSumType 函数我不能 SumType 。现在我有

clientTypes :: [SumType  'Haskell]
clientTypes =
  [ ...
  , mkSumType (Proxy :: Proxy (Uid a))
  ]
main :: IO ()
main = writePSTypes path (buildBridge bridge) clientTypes

它说

• No instance for (Data.Typeable.Internal.Typeable a0)
    arising from a use of ‘mkSumType’
• In the expression: mkSumType (Proxy :: Proxy (Uid a))

我该如何解决?

TypeParameters 模块可用于此目的。只需添加

import Language.PureScript.Bridge.TypeParameters (A)

clientTypes :: [SumType  'Haskell]
clientTypes =
  [ ...
  , mkSumType (Proxy :: Proxy (Uid A))
  ]

会完成任务的。