File tree Expand file tree Collapse file tree 4 files changed +17
-13
lines changed Expand file tree Collapse file tree 4 files changed +17
-13
lines changed Original file line number Diff line number Diff 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 ,
Original file line number Diff line number Diff line change @@ -6,22 +6,25 @@ module Text.Inflections.Tokenizer (
66 canTokenize ,
77 tokenize ) where
88
9+ import Data.Text (Text , pack , unpack )
910import Data.Char (toLower , isDigit , isLower )
1011import Data.Either (isRight )
12+ import Data.Void (Void )
13+
14+ import Text.Megaparsec.Error (ParseErrorBundle )
1115
1216import Text.Inflections
13- import Text.Inflections.Parse.Types
1417import Text.Parsec.Error (ParseError )
1518
1619import 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
2023camelCase :: CaseStyle
21- camelCase = parseCamelCase [] . filter (not . isDigit)
24+ camelCase = parseCamelCase [] . pack . filter (not . isDigit)
2225
2326snakeCase :: CaseStyle
24- snakeCase = parseSnakeCase []
27+ snakeCase = parseSnakeCase [] . pack
2528
2629rubyCase :: CaseStyle
2730rubyCase 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 _ = []
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ allow-newer: true
33packages :
44- " ."
55extra-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
Original file line number Diff line number Diff line change 55
66packages:
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:
You can’t perform that action at this time.
0 commit comments