Skip to content

Commit c836130

Browse files
committed
Fix and note after feedback in the last hasmoku
1 parent ef28795 commit c836130

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

preprocessed-site/posts/2019/regex-applicative.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Just Nothing
201201

202202
### 組み込みの正規表現を使う
203203

204-
例えば、`[Text.Regex.Applicative.Common`モジュールにある`digit`](http://hackage.haskell.org/package/regex-applicative-0.3.3.1/docs/Text-Regex-Applicative-Common.html#v:digit)は、一桁の数字<small>(つまり`0`から`9`)</small>にマッチした上で、結果としてマッチした値を**文字ではなく、整数として**返す正規表現を提供します。
204+
例えば、[`Text.Regex.Applicative.Common`モジュールにある`digit`](http://hackage.haskell.org/package/regex-applicative-0.3.3.1/docs/Text-Regex-Applicative-Common.html#v:digit)は、一桁の数字<small>(つまり`0`から`9`)</small>にマッチした上で、結果としてマッチした値を**文字ではなく、整数として**返す正規表現を提供します。
205205

206206
```haskell
207207
> match digit "1"
@@ -231,7 +231,7 @@ Just 15
231231
### `(<*>) :: RE s (a -> b) -> RE s a -> RE s b`: 任意の関数を適用する
232232

233233
Applicativeスタイルのもう一つの重要な関数といえば、やっぱり`<*>`でしょう。
234-
`many digit`を再利用して、「銭湯に書かれた桁数だけ数字を取得する」という例を書いてみます。
234+
`many digit`を再利用して、「先頭に書かれた桁数だけ数字を取得する」という例を書いてみます。
235235

236236
```haskell
237237
> match (take <$> digit <*> many digit) "312345"
@@ -368,6 +368,7 @@ regex-applicativeを使うことで、URLのオリジンにマッチさせるだ
368368
- Haskell向けのパーサーコンビネーターの多くは`Applicative`ベースのAPIなので、ぱっと見よく似てる
369369
- 場合によっては使うライブラリーだけ換えて式をコピペしてもコンパイルは通る(かも)
370370
- バックトラックするかしないか
371+
- hoge: コード例で示そう
371372
- regex-applicativeの方が部分文字列へのマッチが簡単
372373
- パーサーコンビネーターを、部分文字列のマッチに使いやすくするライブラリーもあるにはある
373374
- [replace-attoparsec](https://github.com/jamesdbrock/replace-attoparsec)

0 commit comments

Comments
 (0)