Permalink
Browse files

Renamed "Jvacuxtoi" to "Jvacux" and "Jvacux" to "Jvacux'"; the new Jv…

…acux is

now used by all exported non-trivial functions
  • Loading branch information...
1 parent 5b5b07f commit 508847a1cabd048ec9f436a44021a6c2a493a484 @jwodder jwodder committed May 5, 2010
Showing with 50 additions and 50 deletions.
  1. +14 −14 haskell/Jbobaf/Jvacux.hs
  2. +10 −10 haskell/Jbobaf/Lerfendi.hs
  3. +1 −1 haskell/Jbobaf/Valsi.hs
  4. +25 −25 haskell/Jbobaf/Vlatai.hs
@@ -9,37 +9,37 @@ module Jbobaf.Jvacux (module Jbobaf.Jvacux, runReaderT, throwError) where
import qualified Data.Set as Set
type JvacuxT m a = ReaderT (Set Tercuxna) m a
- type Jvacux a = ReaderT (Set Tercuxna) Identity a
- type Jvacuxtoi a = ReaderT (Set Tercuxna) (Either String) a
+ type Jvacux a = ReaderT (Set Tercuxna) (Either String) a
+ type Jvacux' a = ReaderT (Set Tercuxna) Identity a
isOpt, isNopt :: Monad m => Tercuxna -> JvacuxT m Bool
- isOpt = asks . Set.member
+ isOpt = asks . Set.member
isNopt = asks . Set.notMember
- nupre :: Jvacuxtoi a -> Jvacux a
+ nupre :: Jvacux a -> Jvacux' a
nupre = mapReaderT (\(Right a) -> return a)
- troci :: Jvacuxtoi a -> Jvacux (Either String a)
+ troci :: Jvacux a -> Jvacux' (Either String a)
troci = mapReaderT return
- kavbu :: Jvacuxtoi a -> (String -> Jvacux a) -> Jvacux a
+ kavbu :: Jvacux a -> (String -> Jvacux' a) -> Jvacux' a
kavbu jct f = ask >>= either f return . runReaderT jct
- snada :: Jvacux a -> Jvacuxtoi a
+ snada :: Jvacux' a -> Jvacux a
snada = mapReaderT (return . runIdentity)
+ xusnada :: Jvacux a -> Jvacux Bool
+ xusnada m = (m >> return True) `mplus` return False
+
{- Are the following functions necessary and/or useful?
- fliba :: String -> Jvacuxtoi a
+ fliba :: String -> Jvacux a
fliba = throwError
- kavbu' :: Jvacuxtoi a -> (String -> Jvacuxtoi a) -> Jvacuxtoi a
+ kavbu' :: Jvacux a -> (String -> Jvacux a) -> Jvacux a
kavbu' = catchError
- xusnada :: Jvacuxtoi a -> Jvacux Bool
- xusnada m = kavbu (m >> return True) (\_ -> return False)
-
- xusnada' :: Jvacuxtoi a -> Jvacuxtoi Bool
- xusnada' m = (m >> return True) `mplus` return False
+ xusnada' :: Jvacux a -> Jvacux' Bool
+ xusnada' m = kavbu (m >> return True) (\_ -> return False)
-}
data Tercuxna =
@@ -61,7 +61,7 @@ module Jbobaf.Lerfendi (lerfendi) where
-- * As far as @lerfendi@ is concerned, ZO and ZEI differ only in spelling.
-- Whether this actually leads to any problems has yet to be determined.
- lerfendi :: String -> Jvacuxtoi [Either String Valsi]
+ lerfendi :: String -> Jvacux [Either String Valsi]
lerfendi = snada . lerfendi' Fadni
----------------------------------------
@@ -78,7 +78,7 @@ module Jbobaf.Lerfendi (lerfendi) where
----------------------------------------
- lerfendi' :: Flezvalei -> String -> Jvacux [Either String Valsi]
+ lerfendi' :: Flezvalei -> String -> Jvacux' [Either String Valsi]
lerfendi' makfa str =
let (ca, ba) = spicpa str
in if null ca then return [] else troci (fadgau ca) >>= \ca' -> case ca' of
@@ -89,7 +89,7 @@ module Jbobaf.Lerfendi (lerfendi) where
----------------------------------------
mafygau :: Flezvalei -> String -> [Either String Valsi]
- -> Jvacux [Either String Valsi]
+ -> Jvacux' [Either String Valsi]
-- How to search for ending ZOI delimiters: While the end has not been found,
-- get the next chunk from the stream and split it into words. If the first
@@ -187,7 +187,7 @@ module Jbobaf.Lerfendi (lerfendi) where
----------------------------------------
- fendi :: String -> Jvacux [Either String Valsi]
+ fendi :: String -> Jvacux' [Either String Valsi]
fendi [] = return []
fendi (',':xs) = fendi xs
-- This ^^ was at one point possible due to some other bit of code. Can this
@@ -241,9 +241,9 @@ module Jbobaf.Lerfendi (lerfendi) where
(xs, a:b:ys) | not (isC b) -> Just (reverse (b:ys), reverse (xs ++ [a]))
| otherwise -> Nothing
- brivlate :: String -> [String] -> Jvacux [Either String Valsi]
+ brivlate :: String -> [String] -> Jvacux' [Either String Valsi]
brivlate pre body@(b1:bxs) = do
- tosmabru <- xulujvo' $ 't':'o':concat body
+ tosmabru <- nupre $ xulujvo' $ 't':'o':concat body
let allInit (c1:c2:xs) = if isV c2 then True
else if isCC [c1, c2] then allInit (c2:xs)
else False
@@ -257,7 +257,7 @@ module Jbobaf.Lerfendi (lerfendi) where
?: (pa, pb, True) :? (pre, [], False)
Nothing -> (pre, [], False)
let beta = b ++ concat body
- xubriv <- xubrivla' beta
+ xubriv <- nupre $ xubrivla' beta
fendi a ~~ if b' && xubriv then mkBrivla beta else shiftCy b body
esv2str :: Either String Valsi -> String
@@ -267,7 +267,7 @@ module Jbobaf.Lerfendi (lerfendi) where
xudenpa :: Char -> Bool
xudenpa c = isSpace c || c == '.'
- shiftCy :: String -> [String] -> Jvacux [Either String Valsi]
+ shiftCy :: String -> [String] -> Jvacux' [Either String Valsi]
shiftCy pre (cy@[_,'y']:rest) = fendi pre ~~ mkCmavo cy ~~ fendi (concat rest)
shiftCy pre blob = return [Left $ pre ++ concat blob]
-- The `pre' argument exists so that it can be prepended to an invalid string
@@ -277,10 +277,10 @@ module Jbobaf.Lerfendi (lerfendi) where
emphed :: String -> Bool
emphed = not . null . filter isUpper
- kavbu' :: Jvacuxtoi a -> a -> Jvacux a
+ kavbu' :: Jvacux a -> a -> Jvacux' a
kavbu' jct d = troci jct >>= return . either (const d) id
- mkCmevla, mkCmavo, mkBrivla :: String -> Jvacux [Either String Valsi]
+ mkCmevla, mkCmavo, mkBrivla :: String -> Jvacux' [Either String Valsi]
mkCmevla [] = return []
mkCmevla str = kavbu' (toCmevla str >>= \v -> return [Right v]) [Left str]
mkCmavo [] = return []
@@ -54,7 +54,7 @@ module Jbobaf.Valsi (
rafsi (Vla2 {ck_rafsi = r}) = r
toValsi, toCmavo, toCmevla, toBrivla, toGismu, toLujvo, toFu'ivla
- :: String -> Jvacuxtoi Valsi
+ :: String -> Jvacux Valsi
toValsi [] = throwError "Empty strings are not {valsi}."
toValsi str = fadgau str >>= \fadni ->
@@ -58,27 +58,27 @@ module Jbobaf.Vlatai (
xubrivla, xugismu, xulujvo, xufu'ivla, xucmevla, xucmavo,
xubrivla', xugismu', xulujvo', xufu'ivla', xucmevla', xucmavo'
:: String -> Jvacux Bool
- xugismu str = kavbu (gismu_xusra str >> return True) (\_ -> return False)
- xugismu' str = kavbu (gismu_xusra' str >> return True) (\_ -> return False)
- xulujvo str = kavbu (lujvo_xusra str >> return True) (\_ -> return False)
- xulujvo' str = kavbu (lujvo_xusra' str >> return True) (\_ -> return False)
- xufu'ivla str = kavbu (fu'ivla_xusra str >> return True) (\_ -> return False)
- xufu'ivla' str = kavbu (fu'ivla_xusra' str >> return True) (\_ -> return False)
- xucmevla str = kavbu (cmevla_xusra str >> return True) (\_ -> return False)
- xucmevla' str = kavbu (cmevla_xusra' str >> return True) (\_ -> return False)
- xucmavo str = kavbu (cmavo_xusra str >> return True) (\_ -> return False)
- xucmavo' str = kavbu (cmavo_xusra' str >> return True) (\_ -> return False)
- xubrivla str = kavbu (brivla_xusra str >> return True) (\_ -> return False)
- xubrivla' str = kavbu (brivla_xusra' str >> return True) (\_ -> return False)
+ xugismu = xusnada . gismu_xusra
+ xugismu' = xusnada . gismu_xusra'
+ xulujvo = xusnada . lujvo_xusra
+ xulujvo' = xusnada . lujvo_xusra'
+ xufu'ivla = xusnada . fu'ivla_xusra
+ xufu'ivla' = xusnada . fu'ivla_xusra'
+ xucmevla = xusnada . cmevla_xusra
+ xucmevla' = xusnada . cmevla_xusra'
+ xucmavo = xusnada . cmavo_xusra
+ xucmavo' = xusnada . cmavo_xusra'
+ xubrivla = xusnada . brivla_xusra
+ xubrivla' = xusnada . brivla_xusra'
- brivla_xusra, brivla_xusra' :: String -> Jvacuxtoi ()
+ brivla_xusra, brivla_xusra' :: String -> Jvacux ()
brivla_xusra str = fadgau str >>= brivla_xusra'
brivla_xusra' str = gismu_xusra' str
`mplus` lujvo_xusra' str
`mplus` fu'ivla_xusra' str
`mplus` throwError "This string is not a {brivla}."
- gismu_xusra, gismu_xusra' :: String -> Jvacuxtoi ()
+ gismu_xusra, gismu_xusra' :: String -> Jvacux ()
gismu_xusra str = fadgau str >>= gismu_xusra'
gismu_xusra' [a, b, c, d, e] = do
noemph <- isOpt Ignore_brivla_emphasis
@@ -87,7 +87,7 @@ module Jbobaf.Vlatai (
xusra (noemph || not (isUpper e)) "Invalid {brivla} emphasis"
gismu_xusra' _ = throwError "{gismu} must be five letterals long."
- lujvo_xusra, lujvo_xusra' :: String -> Jvacuxtoi ()
+ lujvo_xusra, lujvo_xusra' :: String -> Jvacux ()
lujvo_xusra str = fadgau str >>= lujvo_xusra'
lujvo_xusra' str = do
noemph <- isOpt Ignore_brivla_emphasis
@@ -98,7 +98,7 @@ module Jbobaf.Vlatai (
&& not (null $ filter isUpper $ last $ init $ filter voc sylls))
"Invalid {brivla} emphasis"
- fu'ivla_xusra, fu'ivla_xusra' :: String -> Jvacuxtoi ()
+ fu'ivla_xusra, fu'ivla_xusra' :: String -> Jvacux ()
fu'ivla_xusra str = fadgau str >>= fu'ivla_xusra'
fu'ivla_xusra' str = do
noemph <- isOpt Ignore_brivla_emphasis
@@ -107,9 +107,9 @@ module Jbobaf.Vlatai (
let vocSyls = filter voc $ syllabicate str
emphQty = length $ filter (not . null . filter isUpper) vocSyls
xusra (not $ null str) "{fu'ivla} must be non-empty."
- snada (xugismu' str) >>= flip xusra "{fu'ivla} may not be {gismu}." . not
- snada (xulujvo' str) >>= flip xusra "{fu'ivla} may not be {lujvo}." . not
- if isC (head str) then snada (xulujvo' $ 't':'o':str)
+ xugismu' str >>= flip xusra "{fu'ivla} may not be {gismu}." . not
+ xulujvo' str >>= flip xusra "{fu'ivla} may not be {lujvo}." . not
+ if isC (head str) then (xulujvo' $ 't':'o':str)
>>= flip xusra "{fu'ivla} may not fail the tosmabru test" . not
else return ()
xusra (notElem ' ' str) "{fu'ivla} may not have internal spaces or periods."
@@ -128,7 +128,7 @@ module Jbobaf.Vlatai (
let (clust, rest) = span (\c -> isC c || c == 'y') (drop ccLoc str)
preclust = take ccLoc str
preCs = length $ filter isC preclust
- slinky <- snada $ xulujvo' $ 't':'o':drop ccLoc str
+ slinky <- xulujvo' $ 't':'o':drop ccLoc str
if elem 'y' clust || has_C_C clust
|| length (filter voc $ syllabicate rest) == 1
|| ccLoc /= 0 && slinky
@@ -142,7 +142,7 @@ module Jbobaf.Vlatai (
else xusra (ccLoc == 0) "{fu'ivla} may not break apart into smaller words."
Nothing -> throwError "{fu'ivla} must contain a consonant cluster."
- cmevla_xusra, cmevla_xusra' :: String -> Jvacuxtoi ()
+ cmevla_xusra, cmevla_xusra' :: String -> Jvacux ()
cmevla_xusra str = fadgau str >>= cmevla_xusra'
cmevla_xusra' [] = throwError "{cmevla} must be non-empty."
cmevla_xusra' str = do
@@ -158,7 +158,7 @@ module Jbobaf.Vlatai (
\ \"ndj\", \"ndz\", \"ntc\", or \"nts\"."
_ -> return ()
- cmavo_xusra, cmavo_xusra' :: String -> Jvacuxtoi ()
+ cmavo_xusra, cmavo_xusra' :: String -> Jvacux ()
cmavo_xusra str = fadgau str >>= cmavo_xusra'
cmavo_xusra' [] = throwError "{cmavo} must be non-empty."
cmavo_xusra' str@(c:xs) = do
@@ -210,7 +210,7 @@ module Jbobaf.Vlatai (
-- is in effect; otherwise, an invalid vowel cluster causes an error to be
-- thrown
- fadgau :: String -> Jvacuxtoi String
+ fadgau :: String -> Jvacux String
fadgau str = do
accents <- isOpt Allow_accents
ignoring <- isOpt Ignore_naljbo_chars
@@ -300,7 +300,7 @@ module Jbobaf.Vlatai (
then throwError "Apostrophes may not occur at the beginning of a string."
else porfad str' >>= slakate
- jvokatna, jvokatna' :: String -> Jvacuxtoi [String]
+ jvokatna, jvokatna' :: String -> Jvacux [String]
jvokatna str = fadgau str >>= jvokatna'
jvokatna' str = do
xusra (not $ hasNDJ str) "Invalid consonant triple in {lujvo}"
@@ -428,6 +428,6 @@ module Jbobaf.Vlatai (
| isV c = V c : lertype xs
| otherwise = BadCh : lertype xs
- xusra :: Bool -> String -> Jvacuxtoi ()
+ xusra :: Bool -> String -> Jvacux ()
xusra True _ = return ()
xusra False s = throwError s

0 comments on commit 508847a

Please sign in to comment.