<non-user>
Applicative interface can only parse context-free languages; in order to parse context-sensitive languages a Monad interface is needed"return, fmap, join (often called η, T, and μ in the mathematical literature) で定義する流儀もある コーユー話が好き 図式で解く圏論的プログラムとかあったりして… さてもとにかく "`join` for the list monad is just concat" にもハッとさせられて嬉しい その意味で ”Utility functions” の章と参照文献の Henk-Jan van Tuyl A tour of Haskell monad functions は Aha! の宝庫だった 例えば "the analogue of mapM for Applicative is called traverse" に痺れた "Laws" の章では "`(>=>)`" で定式化の一択 "do" の諸章は嫌いなので飛ばし読み ”Further reading” の章は その手が世に氾濫している分充実しているが 大半は既読(消化とは言ってナイ) 圏論的定式化についての Derek Elkins issue 13 of the Monad.Reader は後日再訪してみようwasm-ld: error: unable to find library -lHSrts-1.0.3_thr
foreign-library というstanzaを使え、とのことなんですが、Warning: makeMistakesToLearnHaskell.cabal:123:1: Ignoring section: "foreign-libary"
[1, 2] <> [3, 4] -- Result: [1, 2, 3, 4]
Min 5 <> Min 3 -- Result: Min {getMin = 3}
stimes 4 (Sum 2) -- Result: Sum {getSum = 8}
sconcat ("AB" :| ["12", "xy"]) -- Result: "AB12xy"data Point = Point Int Int deriving (Show, Eq)
instance Semigroup Point where
(Point x1 y1) <> (Point x2 y2) = Point (x1 + x2) (y1 + y2)
p1 = Point 1 2
p2 = Point 10 20
p1 <> p2 -- Result: Point 11 22
stimes 3 (Point 1 1) -> Point 3 3