Haskell 显示新数据的新实例声明
我试图在Haskell中添加实例声明,但未成功。 这是我到目前为止试过的Haskell 显示新数据的新实例声明,haskell,compiler-errors,instance,Haskell,Compiler Errors,Instance,我试图在Haskell中添加实例声明,但未成功。 这是我到目前为止试过的 Instance Show MyBool where show (BTrue) = #t show (BFalse) = #f instance Compuerta MyBool where -- | Método que representa la identidad para el tipo MyBool (.!.) BTrue = BTrue (.!.) BFalse = BFalse --
Instance Show MyBool where
show (BTrue) = #t
show (BFalse) = #f
instance Compuerta MyBool where
-- | Método que representa la identidad para el tipo MyBool
(.!.) BTrue = BTrue
(.!.) BFalse = BFalse
-- | Método que representa la compuerta neg para el tipo MyBool.
(.¬.) BTrue = BFalse
(.¬.) BFalse = BTrue
我有另一个名为Computerta的文件,这个文件很好,但问题似乎出在第一个“where”
当我编译文件时,它会出现
error:parse error on input `where'
如何改进这里有很多错误。我可能遗漏了一些,但它们包括:
Instance
需要是Instance
(这是您引用的错误的直接原因),接下来的两行应该缩进,#t
和#f
需要在(双)引号中。