小编Che*_*pop的帖子

如何在haskell中创建类的类型实例?

我是Haskell的新手.

我正在寻找是否有任何方法来创建类的类型的实例.

有没有办法让这些代码在不使用数据或newtype的情况下工作?

type N = ?n. (n -> n) -> n -> n

instance Printable N where
        print :: N -> IO ()
        read  :: String -> N 
Run Code Online (Sandbox Code Playgroud)

当我尝试在GHCi中加载模块时,它告诉我:

Illegal polymorphic or qualified type: N
In the instance declaration for ‘Printable N’
Run Code Online (Sandbox Code Playgroud)

haskell types church-encoding

2
推荐指数
1
解决办法
1877
查看次数

标签 统计

church-encoding ×1

haskell ×1

types ×1