This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Parser where | |
import Control.Applicative | |
import Data.Text | |
-- the shape of the problem | |
-- | |
-- we want a list of Parsers, all of different types. | |
-- we will apply each of them, one after another, | |
-- in the context of asking questions in some monadic | |
-- context. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators #-} | |
import Control.Applicative | |
import Data.Extensible | |
import Control.Monad.Trans.Maybe | |
import Data.Text | |
-- the shape of the problem | |
-- | |
-- we want a list of Parsers, all of different types. | |
-- we will apply each of them, one after another, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "路線コード": { | |
# "駅コード": (X, Y, Z, "駅名"), ... | |
# }, ... | |
stationInfoTable = { | |
# harutrak A | |
"HA": { | |
"HH": (-285, 59, 346, "役場前"), | |
"NV": (-369, 70, 115, "中村"), # 298 blocks | |
"MM": (-370, 69, -56, "メガネケエスタワー前"), # 161 blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs, FlexibleContexts, TemplateHaskell #-} | |
import Control.Monad.State | |
import qualified Data.IntMap as M | |
import Control.Lens | |
data Field = Field String (M.IntMap Chara) deriving (Show) | |
data Chara = Chara String deriving (Show) | |
updateField f (Field s m) = Field (f s) m | |
updateChara f (Chara s) = Chara (f s) |