HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

  • Packagefgl-5.8.3.1
  • Exports34
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceMonad.hs

Additional Graph Utilities

valuemapFst :: (a -> b) -> (a, c) -> (b, c)
#
valuemapSnd :: (a -> b) -> (c, a) -> (c, b)
#
value(><) :: (a -> b) -> (c -> d) -> (a, c) -> (b, d)
#

Graph Transformer Monad

newtypenewtype GT (m :: Type -> Type) g a
#

Constructors

  • MGT (m g -> m (a, g))
Instances3Monad, Functor, Applicative
  • Monad m => Monad (GT m g)Defined in fgl-5.8.3.1 · Data.Graph.Inductive.Query.Monad
  • Monad m => Functor (GT m g)Defined in fgl-5.8.3.1 · Data.Graph.Inductive.Query.Monad
  • Monad m => Applicative (GT m g)Defined in fgl-5.8.3.1 · Data.Graph.Inductive.Query.Monad
valueapply :: GT m g a -> m g -> m (a, g)
#

Graph Computations Based on Graph Monads

Monadic Graph Accessing Functions

Derived Graph Recursion Operators

valuegraphRec
  1. :: GraphM m gr
  2. => GT m (gr a b) c
  3. -> c -> d -> d
  4. -> d
  5. -> GT m (gr a b) d

encapsulates a simple recursion schema on graphs

Examples: Graph Algorithms as Instances of Recursion Operators

Instances of graphRec

Example: Monadic DFS Algorithm(s)

valuedfsGT :: GraphM m gr => [Node] -> GT m (gr a b) [Node]

Monadic graph algorithms are defined in two steps:

  1. define the (possibly parameterized) graph transformer (e.g., dfsGT)

  2. run the graph transformer (applied to arguments) (e.g., dfsM)