PureScriptの型クラス
基本的なclassとinstanceの構文
purs(hs)class Show a where
show :: a -> String
instance Show String where
show s = s
instance (Show a) => Show (Array a) where
show xs = "[" <> joinWith ", " (map show xs) <> "]"
hsと異なり、 showString
のように名前を付ける必要があった
継承の <=
の向きがhsと逆
purs(hs)class (Monad m) <= MonadFail m where
fail :: forall a. String -> m a
含意とみなせばいい

class A <= B where
B
が存在するならば、 A
が存在する
B
は A
を継承する
>In this particular context, the ⇒
symbol should not be read as implication; infact reverse implication would be a more accurate reading, the intention beingthat every instance of Ord
is also an instance of Eq
.
みたいに書かれてる
emtpy
ってなに?
monad