相关疑难解决方法(0)

为什么使用QuantifiedConstraints指定类型类的子类也需要该子类的实例?

我正在玩一种多类型的无标签编码 Free

{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeOperators #-}
module Free where
import GHC.Types

type (a :: k) ~> (b :: k) = Morphism k a b

newtype Natural (f :: j -> k) (g :: j -> k) = 
  Natural { getNatural :: forall (x :: j). f x ~> …
Run Code Online (Sandbox Code Playgroud)

haskell quantified-constraints

4
推荐指数
1
解决办法
74
查看次数

标签 统计

haskell ×1

quantified-constraints ×1