具有purescript桥的多态类型

时间:2017-08-07 17:32:13

标签: haskell purescript

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

我该如何解决?

1 个答案:

答案 0 :(得分:4)

TypeParameters模块中无效,可用于此目的。只需添加

<Setter Property="Template">
    <Setter.Value>
        <ControlTemplate TargetType="TabItem">
            <Border Name="Border"
                                Width="145"
                                Margin="10"
                                Padding="0"
                                BorderThickness="0"
                                CornerRadius="20">
                <ContentPresenter x:Name="ContentSite"
                                              Margin="10"
                                              HorizontalAlignment="Center"
                                              VerticalAlignment="Center"
                                              ContentSource="Header" TextBlock.Foreground="{StaticResource DarkGrayBrush}" />
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource DarkGreenBrush}" />
                    <Setter TargetName="ContentSite" Property="TextBlock.Foreground"
                            Value="{StaticResource ForegroundColorBrush}" />
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </Setter.Value>
</Setter>

将完成工作。