## 檔名、路徑

把 `sample/` 下的檔案做了些調整：

```Haskell
-- A.hs
module Main where

import Prelude ()
import B

main = putStrLn $ hello ++ ", " ++ world
```

```Haskell
-- B.hs
module B where

import Prelude ()
import Chat.C

hello = "hello"
```

```Haskell
-- Chat/C.hs
module Chat.C where

world = "world"
```

現在要把 `"Chat.C"` 變成 `"Chat/C.hs"` 。

在 [System.FilePath][filepath] 的協助下，很簡單就能做到。

先在 `my-project.cabal` 加上

```
build-depends:       base
                   , my-project
                   , filepath
                   , -- 略
```

然後：

```Haskell
toModPath :: String -> String
toModPath str = map go str where
  go '.' = pathSeparator
  go c = c
```

處理 module 名時則：

```Haskell
import System.FilePath
-- 略
content <- readFile $ toMdoPath modName ++ (extSeparator : "hs")
-- 後略
```

`pathSeparator` 和 `extSeparator` 都是 System.FilePath 提供的函數，會按使用的平台（POSIX 或 Windows），給出正確的 `Char` 。

[filepath]: https://hackage.haskell.org/package/filepath-1.4.1.0

## 然後

第一次 BYOHC 重開機（？）的進度就到此。

當初許下的願望，像是 lambda calculus interpreter ，已經做出來了。也學到很多沒想過會去學的事，像英文閱讀速度就比之前快。可是這其實只是入門，離能把 Haskell 當成自己的工具、在日常與工作上使用，還有很長一段距離。也許接下來還是回到初衷，看看一個 functional language compiler 是怎麼建立的、看看前人踩了多少雷，補足匱乏的知識，才有往前走的動力。
