我输入了 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))
  ]

将完成工作。

关于haskell - 带有 purescript-bridge 的多态类型,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45552591/

10-11 16:28