行程备忘

交通

飞机

  • 2016.02.15 北京-东京 [08:25 - 12:45] < T3, 羽田 > JL020
  • 2016.02.21 东京-冲绳 [10:30 - 13:20] <羽田, 冲绳> NH469
  • 2016.02.25 冲绳-东京 [14:10 - 16:30] <冲绳, 羽田> NH468
  • 2016.02.27 东京-北京 [18:00 - 21:30] <成田, T3> JL869

地下铁


住宿

  • 02.15 - 02.20 ホテルマイステイズ横浜(中区末吉町4-81,横浜市, 231-0055)

    • 机场->宾馆(方案一 ¥480) :
      Keikyu Line Haneda Airport Domestic Termination Station ->
      (京急机场线:Airport急行 新逗子) -> 6站同车(京急本线) -> 神奈川新町 ->
      (京急本线 各停 开往浦贺) -> 黄金町 -> 120米
      
  • 02.20 - 02.21 東京木場ホテル(江東区木場1-4-3, 江東区, 東京都, 135-0042)

    • 宾馆->宾馆(¥640):
      黄金町 -> (京急本线各停->品川) -> 横滨 -> (京急本线快特->京成高砂) -> (同车浅草线) -> 日本桥
      -> (东西线->东叶胜田台) -> 木场(东京) -> 270米
      
    • 宾馆->机场(¥730):
      木场 -> (东西线->中野) -> 日本桥 -> (浅草快特->羽田机场) -> (坐10站就对了) -> Keiyu Line Haneda
      
  • 02.21 - 02.25 HOTEL StoRK 那覇新都心(おもろまち2-6-40 那覇市, 900-0006)

    • 机场->宾馆(¥300): 结心电车(赤嶺駅 - 歌町)
    • 宾馆->机场(¥300): 结心电车
  • 02.25 - 02.27 〒フレックステイイン東十条(114-0032 東京都, 北区中十条2-10-2, 日本, 東京都, JP)

    • 机场->宾馆(¥710):
      羽田机场第二大楼 -> (东京单轨电车) -> 滨松町 -> (京滨东北线) -> 东十条 -> 210米
      
    • 宾馆->机场(¥1400):
      东十条 -> (京滨东北线快速->蒲田) -> 田端(东京) -> (山手线:各停 外环) ->
      日暮里 -> (京城本线特急->成田空港) -> 京成高砂 -> (sky kusesu线->成田) -> 空港第二楼
      

预算总计: ¥4560


安排

日期 宿泊 早间备选地点 午饭 下午备选地点 晚饭 备注+晚间
02.15 横滨 飞机餐 横滨站周边 豊野丼^1 抵达12:45 休整好约14:00
02.16 横滨 中华街、关帝庙 福満園^2 sea paradise水族馆 CANTINA逗子店^3 晚餐也可选择松屋
02.17 横滨 三溪园 Kichinro拉面 泡面博物馆 一风堂 lotteria汉堡!!
02.18 横滨 铁道模型博物馆 回转寿司[^6] 拉面博物馆 温野菜^4五点之后 藍屋 いたり家^5
02.19 横滨 富!士!山! 华丽屋咖喱 lotteria汉堡 Makaino Farm牧场可以一去
02.20 东京 秋叶原 高达咖啡 果断还是秋叶原 Isomarusuisan
02.21 那霸 国际大道 Suitenrou
02.22 那霸 首里城 しむじょう^7 金城町石叠 备选里挑一家吧 备选餐厅^8 三竹寿(tsuke面)
02.23 那霸 识名园 蓝蓝路无名汉堡 波之上海滩 高良食堂
02.24 那霸 やちむん通り Bambohe烧肉^9 午饭吉野家! 奢侈的kaki小屋(5:30)
02.25 东京 第一牧志公设市场 2F海鲜饭! 随便吧(
02.26 东京 台场看无聊的高达 回转寿司[^10] 大概就是秋叶原了
02.27 北京 回家啦

[^6]: Mawashizushi KATSU katumidori.co.jp

[^10]: Muten Kura Sushi Shinagawa Ekimae

一颗赛艇的Haskell资料

感觉有必要留出一个地方Mark一些很Mind Blow的资源,来观察一下我的技能树到底是怎么点歪的(误
绝赞更新中!(不

  • The Algebra of Algebraic Data Types

    Type calculus好顶赞。解释了我多年Algebra Datatype为什么名字带Algebra的困惑(。
    在类型上做代数运算什么的简直打开了新世界的大门!

  • Comonads are objects

    我见过最通俗易懂的介绍Comonad的文章。通俗到了什么程度呢?在看前两个例子的时候我甚至没反应过来是在说Comonad…
    如果说Monad使Haskell成为最好的命令式语言,那么Comonad就使Haskell成为了最好的面向对象语言(笑

Kata:Lens-Maker

最近在研究Profunctor这个东西。其定义虽然很简单但却有点意义不明..
听人安利这个Kata做完就会有个大概的认识于是试一试。

这个Kata基本上就是从头造个Lens库出来.. 难度自然也是鬼畜级别的。所以可能会坑很多天..


首先是一些基本类型定义。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE RankNTypes #-}

module MicroLens where

import Control.Applicative
import Data.Monoid
import qualified Data.Traversable as T
import Prelude hiding (sum)
import Unsafe.Coerce

---------------------------------------------------------
-- Some basic libraries

class Profunctor p where

dimap :: (a' -> a) -> (b -> b') -> (p a b -> p a' b')
dimap f g = lmap f . rmap g
lmap :: (a' -> a) -> (p a b -> p a' b)
lmap f = dimap f id
rmap :: (b -> b') -> (p a b -> p a b')
rmap f = dimap id f

class Profunctor p => Choice p where

left' :: p a b -> p (Either a c) (Either b c)
right' :: p a b -> p (Either c a) (Either c b)

instance Profunctor (->) where

dimap f g h = g . h . f

instance Choice (->) where

left' f = either (Left . f) Right
right' f = either Left (Right . f)

class Contravariant f where

contramap :: (a' -> a) -> (f a -> f a')

-- Control.Applicative.Const replicated here for your
-- convenience
newtype K b a = K { getK :: b } deriving Functor

instance Monoid b => Applicative (K b) where

pure _ = K mempty
K e <*> K f = K (e <> f)

instance Contravariant (K b) where

contramap f (K b) = K b

newtype Id a = Id { getId :: a } deriving Functor

instance Applicative Id where

pure = Id
Id f <*> Id x = Id (f x)

---------------------------------------------------------
-- The lens types you'll implement

-- | Optic is the general pattern for all other lens types.
type Optic p f s t a b =
p a (f b) -> p s (f t)

type Iso s t a b =
forall p f . (Profunctor p, Functor f) =>
Optic p f s t a b

type Lens s t a b =
forall f . Functor f =>
Optic (->) f s t a b

type Traversal s t a b =
forall f . Applicative f =>
Optic (->) f s t a b

type Fold s a =
forall f . (Contravariant f, Applicative f) =>
Optic (->) f s s a a

type Prism s t a b =
forall p f . (Choice p, Applicative f) =>
Optic p f s t a b

那么先从最简单的_1,_2开始。它们的语义很简单,分别“聚焦”于一个pair的第一个元素和第二个元素。

1
2
3
4
5
6
7
-- | A lens focusing on the first element in a pair
_1 :: Lens (a, x) (b, x) a b
_1 = undefined

-- | A lens focusing on the second element in a pair
_2 :: Lens (x, a) (x, b) a b
_2 = undefined

类型签名可能有些吓人,不过我们展开之后可以发现,_1的类型为(a -> f b) -> ((a, x) -> f (b, x)),某种意义上相当于pairfmap
Follow the type,我们可以很容易地写出实现:

1
2
3
4
5
6
7
-- | A lens focusing on the first element in a pair
_1 :: Lens (a, x) (b, x) a b
_1 = \f (a,x) -> (, x) <$> f a

-- | A lens focusing on the second element in a pair
_2 :: Lens (x, a) (x, b) a b
_2 = \f (x,a) -> (x, ) <$> f a

update : 今天肝完了后半部分.. 然而完全不理解自己在做什么。于是放上看到的最优雅的实现,希望有朝一日我也能解释(

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
-- | A function which takes a lens and looks through it.
-- The type given is specialized to provide a hint as to
-- how to write 'view'. The more intuitive type for its use
-- is
--
-- @
-- view :: Lens s t a b -> (s -> a)
-- @
view :: Optic (->) (K a) s t a b -> (s -> a)
view l = getK . l K

-- | A function which takes a lens and a transformation function
-- and applies that transformer at the focal point of the lens.
-- The type given is specialized to provide a hint as to how to
-- write 'over'. The more intuitive type for its use is
--
-- @
-- over :: Lens s t a b -> (a -> b) -> (s -> t)
-- @
over :: Optic (->) Id s t a b -> (a -> b) -> (s -> t)
over l f = getId . l (Id . f)

-- | A function from a lens and a value which sets the value
-- at the focal point of the lens. The type given has been
-- specialized to provide a hint as to how to write 'set'. The
-- more intuitive type for its use is
--
-- @
-- set :: Lens s t a b -> b -> (s -> t)
-- @
set :: Optic (->) Id s t a b -> b -> (s -> t)
set l b = getId . l (Id . const b)

-- | A traversal which focuses on each element in any
-- Traversable container.
elements :: T.Traversable f => Traversal (f a) (f b) a b
elements = T.traverse

-- | A function which takes a Traversal and pulls out each
-- element it focuses on in order. The type has been
-- specialized, as the others, but a more normal type might be
--
-- @
-- toListOf :: Traversal s s a a -> (s -> [a])
-- @
toListOf :: Optic (->) (K (Endo [a])) s s a a -> (s -> [a])
toListOf l s = appEndo (getK $ l (\a -> K $ Endo (a:)) s) []

-- | A function which takes any kind of Optic which might
-- be focused on zero subparts and returns Just the first
-- subpart or else Nothing.
--
-- @
-- preview :: Traversal s s a a -> (s -> Maybe a)
-- @
preview :: Optic (->) (K (First a)) s s a a -> (s -> Maybe a)
preview l s = getFirst (getK $ l (\a -> K $ First $ Just a) s)

-- | A helper function which witnesses the fact that any
-- container which is both a Functor and a Contravariant
-- must actually be empty.
coerce :: (Contravariant f, Functor f) => f a -> f b
coerce = contramap (const ()) . fmap (const ())

-- f a -> f Void

-- | A Fold which views the result of a function application
to :: (a -> b) -> Fold a b
to f g = contramap f . g . f

-- | A prism which focuses on the left branch of an Either
_Left :: Prism (Either a x) (Either b x) a b
_Left = rmap (either (fmap Left) (pure . Right)) . left'

-- | A prism which focuses on the right branch of an Either
_Right :: Prism (Either x a) (Either x b) a b
_Right = rmap (either (pure . Left) (fmap Right)) . right'

-- | An iso which witnesses that tuples can be flipped without
-- losing any information
_flip :: Iso (a, b) (a, b) (b, a) (b, a)
_flip = dimap swap (fmap swap) where swap (a, b) = (b, a)