Skip to content

Instantly share code, notes, and snippets.

View fumieval's full-sized avatar
🐦
Birb

Fumiaki Kinoshita fumieval

🐦
Birb
View GitHub Profile
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.
@fumieval
fumieval / extensible.hs
Last active March 17, 2018 20:48 — forked from cdepillabout/extensible.hs
small example of hlist from extensible library
{-# 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,
# "路線コード": {
# "駅コード": (X, Y, Z, "駅名"), ...
# }, ...
stationInfoTable = {
# harutrak A
"HA": {
"HH": (-285, 59, 346, "役場前"),
"NV": (-369, 70, 115, "中村"), # 298 blocks
"MM": (-370, 69, -56, "メガネケエスタワー前"), # 161 blocks
@fumieval
fumieval / progLA.hs
Last active August 29, 2015 14:05 — forked from myuon/progLA.hs
{-# 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)