The module hymn.dsl provides types and functions from other modules of this package, so that they can be imported all at once easily.


from hymn.dsl import *


(import [hymn.dsl [*]])

This module also provides all the macros defined in other modules,

(require hymn.dsl)

is all you need to use any macro defined in Hymn


Some of the function are renamed to more descriptive one to avoid name clash, examples are hymn.types.reader.lookup() and hymn.types.state.lookup()

The entire source code of this module is listed here for reference:

  [hymn.types.monoid [<> append]]
    [Continuation cont-m continuation-m
     run :as run-cont]]
    [Either either-m
     Left Right left? right? either failsafe]]
  [hymn.types.lazy [Lazy lazy-m evaluate :as evaluate-lazy force lazy?]]
  [hymn.types.list [List fmap list-m]]
    [Maybe maybe-m
     Just Nothing <-maybe ->maybe from-maybe maybe nothing? to-maybe]]
    [Reader reader-m
     <- :as <-r
     ask ask :as get-env
     asks asks :as get-env-with
     local local :as use-env-with
     lookup :as lookup-reader
     run :as run-reader]]
    [State state-m
     <-state get-state set-state state<-
     <- :as <-s
     evaluate :as evaluate-state
     execute :as execute-state
     gets gets :as get-state-with
     lookup :as lookup-state
     modify modify :as modify-state-with
     run :as run-state
     set-value set-value :as set-state-value
     set-values set-values :as set-state-values
     update update :as update-state-value-with
     update-value update-value :as update-state-value]]
    [ComplexWriter complex-writer-m
     DecimalWriter decimal-writer-m
     FloatWriter float-writer-m
     FractionWriter fraction-writer-m
     ListWriter list-writer-m
     IntWriter int-writer-m
     StringWriter string-writer-m
     TupleWriter tuple-writer-m
     censor listen tell writer
     run :as run-writer
     execute :as execute-writer]]
    [k-compose <=< k-pipe >=> lift m-map replicate sequence]]
  [hymn.utils [compose <| const pipe |>]])

;;; reader macro for the continuation monad
(require hymn.types.continuation)

;;; reader macro for the either monad
(require hymn.types.either)

;;; macros for the lazy monad
(require hymn.types.lazy)

;;; reader macro for the list monad
(require hymn.types.list)

;;; reader macro for the maybe monad
(require hymn.types.maybe)

;;; reader macro for the writer monad
(require hymn.types.writer)

;;; macros for monad operations
(require hymn.operations)