Skip to content

Commit 46f0ef0

Browse files
committed
Update inflectors
1 parent 6e18303 commit 46f0ef0

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

mulang.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ library
126126
containers ,
127127
hashable ,
128128
haskell-src ,
129-
inflections <= 0.2.0.1,
129+
inflections <= 0.4.0.7,
130+
megaparsec ,
130131
language-c ,
131132
language-java ,
132133
language-javascript ,

src/Text/Inflections/Tokenizer.hs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@ module Text.Inflections.Tokenizer (
66
canTokenize,
77
tokenize) where
88

9+
import Data.Text (Text, pack, unpack)
910
import Data.Char (toLower, isDigit, isLower)
1011
import Data.Either (isRight)
12+
import Data.Void (Void)
13+
14+
import Text.Megaparsec.Error (ParseErrorBundle)
1115

1216
import Text.Inflections
13-
import Text.Inflections.Parse.Types
1417
import Text.Parsec.Error (ParseError)
1518

1619
import Control.Fallible
1720

18-
type CaseStyle = String -> Either Text.Parsec.Error.ParseError [Text.Inflections.Parse.Types.Word]
21+
type CaseStyle = String -> Either (ParseErrorBundle Text Void) [SomeWord]
1922

2023
camelCase :: CaseStyle
21-
camelCase = parseCamelCase [] . filter (not.isDigit)
24+
camelCase = parseCamelCase [] . pack . filter (not.isDigit)
2225

2326
snakeCase :: CaseStyle
24-
snakeCase = parseSnakeCase []
27+
snakeCase = parseSnakeCase [] . pack
2528

2629
rubyCase :: CaseStyle
2730
rubyCase word@(i:_) | i == '_' = snakeCase . unprivatize $ baseWord
@@ -48,7 +51,7 @@ tokenize style s | Just words <- (wordsOrNothing . style) s = concatMap toToken
4851
| otherwise = []
4952
where toToken = return . map toLower
5053

51-
52-
wordsOrNothing = fmap (concatMap c) . orNothing
53-
where c (Word w) = [w]
54+
wordsOrNothing :: Either (ParseErrorBundle Text Void) [SomeWord] -> Maybe [String]
55+
wordsOrNothing = fmap (concatMap c ) . orNothing
56+
where c (SomeWord w) = [unpack . unWord $ w]
5457
c _ = []

stack.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ allow-newer: true
33
packages:
44
- "."
55
extra-deps:
6-
- inflections-0.2.0.1
6+
- inflections-0.4.0.7
77
- github: mumuki/language-javascript
88
commit: 7cadfa30838c69d165df39a5c1524dae5a0fc81f
99
- github: bjpop/language-python

stack.yaml.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
packages:
77
- completed:
8-
hackage: inflections-0.2.0.1@sha256:f486f8caad1a9d1d11d8cbb4275369bffbd80e87d1df0241ddb17ebb01e6e80f,2227
8+
hackage: inflections-0.4.0.7@sha256:1fd4a14864f24d643c0f19d5c47ad022c8c9748d5842ebb2ec892ba98394de53,3551
99
pantry-tree:
10-
sha256: 8471af52b2b16017e541ea9084f563913845112e2cef02d22b797343fcf3de9a
11-
size: 1716
10+
sha256: d566a6956df9a1b9e04b5a85e9bbf69921d362a70fa7c145fe4963dfdf0ca942
11+
size: 2077
1212
original:
13-
hackage: inflections-0.2.0.1
13+
hackage: inflections-0.4.0.7
1414
- completed:
1515
name: language-javascript
1616
pantry-tree:

0 commit comments

Comments
 (0)