PureScriptの型クラス
基本的なclassとinstanceの構文
code: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と逆
code:purs(hs)
class (Monad m) <= MonadFail m where
fail :: forall a. String -> m a
含意とみなせばいいmrsekut.icon
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