brassica-1.0.0: Featureful sound change applier
CopyrightSee LICENSE file
LicenseBSD3
MaintainerBrad Neimann
Safe HaskellSafe-Inferred
LanguageHaskell2010

Brassica.SoundChange.Frontend.Internal

Description

Warning: This module is internal, and does not follow the Package Versioning Policy. It may be useful for extending Brassica, but be prepared to track development closely if you import this module.

This module exists primarily as an internal common interface for Brassica’s two ‘official’ GUI frontends (desktop and web). If you wish to make your own frontend to Brassica, it is probably easier to write it yourself rather than trying to use this.

Synopsis

Documentation

data ApplicationMode Source #

Rule application mode of the SCA.

Constructors

ApplyRules HighlightMode OutputMode String

Apply sound changes as normal, with the given modes and separator

ReportRulesApplied

Apply reporting the rules which were applied (as HTML)

getOutputMode :: ApplicationMode -> OutputMode Source #

Get the OutputMode if one is set, otherwise default to WordsOnlyOutput.

data ApplicationOutput a r Source #

Output of a single application of rules to a wordlist: either a list of possibly highlighted words, an applied rules table, or a parse error.

Instances

Instances details
Generic (ApplicationOutput a r) Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

Associated Types

type Rep (ApplicationOutput a r) :: Type -> Type #

(Show a, Show r) => Show (ApplicationOutput a r) Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

(NFData a, NFData r) => NFData (ApplicationOutput a r) Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

Methods

rnf :: ApplicationOutput a r -> () #

type Rep (ApplicationOutput a r) Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

type Rep (ApplicationOutput a r) = D1 ('MetaData "ApplicationOutput" "Brassica.SoundChange.Frontend.Internal" "brassica-1.0.0-23v7eBGV3gz5i0Q0Z9IDsG" 'False) (C1 ('MetaCons "HighlightedWords" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Component (a, Bool)])) :+: (C1 ('MetaCons "AppliedRulesTable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Log r])) :+: C1 ('MetaCons "ParseError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ParseErrorBundle String Void)))))

data MDFHierarchy Source #

For MDF input, the hierarchy used

Constructors

Standard 
Alternate 

data ParseOutput a Source #

Either a list of Components for a Brassica wordlist file, or a list of SFM fields for an MDF file

Constructors

ParsedRaw [Component a] 
ParsedMDF SFM 

Instances

Instances details
Foldable ParseOutput Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

Methods

fold :: Monoid m => ParseOutput m -> m #

foldMap :: Monoid m => (a -> m) -> ParseOutput a -> m #

foldMap' :: Monoid m => (a -> m) -> ParseOutput a -> m #

foldr :: (a -> b -> b) -> b -> ParseOutput a -> b #

foldr' :: (a -> b -> b) -> b -> ParseOutput a -> b #

foldl :: (b -> a -> b) -> b -> ParseOutput a -> b #

foldl' :: (b -> a -> b) -> b -> ParseOutput a -> b #

foldr1 :: (a -> a -> a) -> ParseOutput a -> a #

foldl1 :: (a -> a -> a) -> ParseOutput a -> a #

toList :: ParseOutput a -> [a] #

null :: ParseOutput a -> Bool #

length :: ParseOutput a -> Int #

elem :: Eq a => a -> ParseOutput a -> Bool #

maximum :: Ord a => ParseOutput a -> a #

minimum :: Ord a => ParseOutput a -> a #

sum :: Num a => ParseOutput a -> a #

product :: Num a => ParseOutput a -> a #

Traversable ParseOutput Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

Methods

traverse :: Applicative f => (a -> f b) -> ParseOutput a -> f (ParseOutput b) #

sequenceA :: Applicative f => ParseOutput (f a) -> f (ParseOutput a) #

mapM :: Monad m => (a -> m b) -> ParseOutput a -> m (ParseOutput b) #

sequence :: Monad m => ParseOutput (m a) -> m (ParseOutput a) #

Functor ParseOutput Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

Methods

fmap :: (a -> b) -> ParseOutput a -> ParseOutput b #

(<$) :: a -> ParseOutput b -> ParseOutput a #

Show a => Show (ParseOutput a) Source # 
Instance details

Defined in Brassica.SoundChange.Frontend.Internal

tokeniseAccordingToInputFormat :: InputLexiconFormat -> OutputMode -> SoundChanges Expanded GraphemeList -> String -> Either (ParseErrorBundle String Void) [Component PWord] Source #

Given the selected input and output modes, and the expanded sound changes, tokenise the input according to the format which was selected

parseTokeniseAndApplyRules Source #

Arguments

:: (forall a b. (a -> b) -> [Component a] -> [Component b])

mapping function to use (for parallelism)

-> SoundChanges Expanded GraphemeList

changes

-> String

words

-> InputLexiconFormat 
-> ApplicationMode 
-> Maybe [Component PWord]

previous results

-> ApplicationOutput PWord (Statement Expanded GraphemeList) 

Top-level dispatcher for an interactive frontend: given a textual wordlist and a list of sound changes, returns the result of running the changes in the specified mode.