packages feed

dawg-ord 0.4.0.1 → 0.4.0.2

raw patch · 6 files changed

+26/−25 lines, 6 files

Files

dawg-ord.cabal view
@@ -1,5 +1,5 @@ name:               dawg-ord-version:            0.4.0.1+version:            0.4.0.2 synopsis:           Directed acyclic word graphs description:     The library implements /directed acyclic word graphs/ (DAWGs) internally
src/Data/DAWG/Int.hs view
@@ -3,8 +3,8 @@ -- The implementation provides a fast insert operation which can be -- used to build the DAWG structure incrementaly. ----- Keys and values must provide an `Enum` instance; see the--- `Data.DAWG.Ord` module if you look for a more generic solution.+-- Keys and values must provide an 'Enum' instance; see the+-- 'Data.DAWG.Ord' module if you look for a more generic solution.   module Data.DAWG.Int@@ -12,6 +12,7 @@ -- * DAWG type   DAWG , ID+, Val , root  -- * Query
src/Data/DAWG/Int/Dynamic.hs view
@@ -300,7 +300,7 @@ ------------------------------------------------------------  --- | A list of outgoing edges.+-- | A list of outgoing edges (automaton transitions). edges :: Enum a => ID -> DAWG a -> [(a, ID)] edges i     = map (first toEnum)@@ -310,12 +310,12 @@ {-# SPECIALIZE edges :: ID -> DAWG Int  -> [(Int, ID)]  #-}  --- | Value stored in the given state.+-- | Value stored in the given automaton state. value :: ID -> DAWG a -> Maybe Val value i = N.value . G.nodeBy i . graph  --- | Follow the given transition from the given state.+-- | Follow a transition with the given symbol from the given state. follow :: Enum a => ID -> a -> DAWG a -> Maybe ID follow i x DAWG{..} = flip S.evalState graph $ runMaybeT $     followPath [fromEnum x] i
src/Data/DAWG/Int/Dynamic/Internal.hs view
@@ -16,16 +16,16 @@ import qualified Data.DAWG.Int.Dynamic.Node as N  --- | A directed acyclic word graph with phantom type `a`--- representing the type of alphabet symbols.--- Type `a` must probide an `Enum` instance.+-- | A directed acyclic word graph with phantom type @a@+-- representing the type of alphabet symbols (type @a@ must provide+-- an 'Enum' instance). ----- A DAWG is, semantically, a map from keys (sequences of `a`s) to--- integral values (see `Data.DAWG.Ord` for a more generic version of--- DAWGs).+-- A DAWG is, semantically, a map from keys (sequences of @a@'s) to+-- integral values.+-- See 'Data.DAWG.Ord' for a more generic version of DAWGs. data DAWG a = DAWG     { graph :: !(Graph N.Node)-    -- | Foot of the DAWG.+    -- | Root of the DAWG.     , root  :: !ID }     deriving (Show, Eq, Ord) 
src/Data/DAWG/Ord.hs view
@@ -1,5 +1,5 @@--- | A version of `Data.DAWG.Int` adapted to keys and values with--- `Ord` instances.+-- | A version of 'Data.DAWG.Int' adapted to keys and values with+-- 'Ord' instances.   module Data.DAWG.Ord
src/Data/DAWG/Ord/Dynamic.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE RecordWildCards #-}  --- | A version of `Data.DAWG.Int.Dynamic` adapted to--- keys and values with `Ord` instances.+-- | A version of 'Data.DAWG.Int.Dynamic' adapted to+-- keys and values with 'Ord' instances.   module Data.DAWG.Ord.Dynamic@@ -52,12 +52,12 @@ ------------------------------------------------------------  --- | A directed acyclic word graph (DAWG) with type `a` representing--- the type of alphabet symbols (over which keys are constructued)--- and type `b` -- the type of values.+-- | A directed acyclic word graph (DAWG) with type @a@ representing+-- the type of alphabet symbols (over which keys are constructed)+-- and type @b@ -- the type of values. ----- A DAWG is, semantically, a map from keys (sequences of `a`s) to--- values `b`.+-- A DAWG is, semantically, a map from keys (sequences of @a@'s) to+-- values @b@. data DAWG a b = DAWG     { intDAWG   :: D.DAWG Sym     , symMap    :: M.Map a Int@@ -212,21 +212,21 @@ ------------------------------------------------------------  --- | Value stored in the given node.+-- | Value stored in the given automaton state. value :: ID -> DAWG a b -> Maybe b value i DAWG{..}  = do     x <- D.value i intDAWG     M.lookup x valMapR  --- | A list of outgoing edges.+-- | A list of outgoing edges (automaton transitions). edges :: ID -> DAWG a b -> [(a, ID)] edges i DAWG{..} = map     (first (symMapR M.!))     (D.edges i intDAWG)  --- | Follow the given transition from the given state.+-- | Follow a transition with the given symbol from the given state. follow :: Ord a => ID -> a -> DAWG a b -> Maybe ID follow i x DAWG{..} = do     y <- M.lookup x symMap