Safe Haskell | None |
---|
Rewrite expressions and modules attaching tags to numeric literals.
- mk_var :: String -> Exp
- mk_str_lit :: String -> Exp
- mk_int_lit :: Integral n => n -> Exp
- mk_frac_lit :: Real n => n -> Exp
- exp_num_lit :: Exp -> Maybe Literal
- tag_exp :: String -> Exp -> Exp
- at_tagged :: (String -> Exp -> Exp) -> (Exp -> Exp) -> Exp -> Exp
- untag_exp :: Exp -> Exp
- nil_src_loc :: SrcLoc
- mk_span_id :: String -> [Exp] -> Exp
- tag_to_span :: Exp -> Exp
- tag_exp_auto :: Exp -> State Int Exp
- span_exp_auto :: Exp -> State Int Exp
- at_num_lit :: (Exp -> t) -> (Exp -> t) -> Exp -> t
- tag_num_lit :: Exp -> State Int Exp
- span_num_lit :: Exp -> State Int Exp
- type Parser r = String -> ParseResult r
- type RW t m a = t -> m a
- type RW_st t a = t -> State Int a
- type Tr = String -> String
- type Tr_m m = String -> m String
- type RW_Opt = (PPLayout, Int)
- apply_rw :: (Monad m, Pretty a) => RW_Opt -> Parser t -> RW t m a -> Tr_m m
- apply_rw_pure :: Pretty a => RW_Opt -> Parser t -> (t -> a) -> Tr
- apply_rw_st :: Pretty a => RW_Opt -> Parser t -> RW_st t a -> Tr
- exp_rw :: String -> String
- module_rw :: String -> String
- exp_un_rw :: String -> String
- rw_html_opt :: RW_Opt
- exp_rw_html :: String -> String
- module_rw_html :: String -> String
- exp_html :: String -> String
- module_html :: String -> String
- html_framework :: String -> String -> String
Documentation
mk_str_lit :: String -> ExpSource
Make String
Lit
.
mk_str_lit "c1" == Lit (String "c1")
mk_int_lit :: Integral n => n -> ExpSource
Make Int
Lit
.
mk_frac_lit :: Real n => n -> ExpSource
exp_num_lit :: Exp -> Maybe LiteralSource
Numeric literal at Exp
else Nothing
Inverse of tag_exp
.
let z = mk_int_lit (0::Integer) in untag_exp (Paren (tag_exp "c1" z)) == z
Empty source location.
mk_span_id :: String -> [Exp] -> ExpSource
tag_to_span :: Exp -> ExpSource
tag_exp_auto :: Exp -> State Int ExpSource
Variant of tag_exp
that derives the the tag name using a
State
counter.
span_exp_auto :: Exp -> State Int ExpSource
at_num_lit :: (Exp -> t) -> (Exp -> t) -> Exp -> tSource
Apply f at numeric literals, else g.
tag_num_lit :: Exp -> State Int ExpSource
span_num_lit :: Exp -> State Int ExpSource
type Parser r = String -> ParseResult rSource
exp_rw :: String -> StringSource
Rewrite Exp
.
let r = "sinOsc AR (tag \"c1\" 440) (tag \"c2\" 0) * tag \"c3\" 0.1" in exp_rw "sinOsc AR 440 0 * 0.1" == r
module_rw :: String -> StringSource
Rewrite Module
.
let m = ["import Sound.SC3" ,"o = sinOsc AR (midiCPS 65.00) 0.00" ,"a = dbAmp (-12.00)" ,"main = audition (out 0.00 (o * a))"] in module_rw (unlines m)
RW_Opt
for html. The span code generates long lines...
exp_rw_html :: String -> StringSource
Transform re-written form to HTML
.
let e = "sinOsc AR 440 0 * 0.1" in exp_rw_html (exp_rw e)
module_rw_html :: String -> StringSource
Module
variant of exp_rw_html
.
let m = "o = sinOsc AR 440 0 * 0.1\nmain = audition (out 0 o)" in module_rw_html (module_rw m)
module_html :: String -> StringSource
html_framework :: String -> String -> StringSource