相关疑难解决方法(0)

为什么ghci可以看到非导出类型和构造函数?我该如何解决?

我是Haskell的新手.这是一些简单的代码:

module Src
(   -- The 'Answer' type isn't exported
    Shape(Circle), -- i.e 'Rectangle' data constructor isn't exported
    Point(..),
    area,
    nudge
) where

data Answer = Yes | No deriving (Show)

data Point = Point Float Float deriving (Show)

data Shape = Circle Point Float | Rectangle Point Point
    deriving (Show)

area :: Shape -> Float
area (Circle _ r) = pi * r ^ 2
area (Rectangle (Point x1 y1) (Point x2 y2)) = (abs $ x2 - x1) …
Run Code Online (Sandbox Code Playgroud)

haskell ghci

5
推荐指数
1
解决办法
380
查看次数

标签 统计

ghci ×1

haskell ×1