(.module: lux (lux (control [equality #+ Eq] [codec #+ Codec] hash) (data [text "text/" Monoid Eq]))) ## [Types] ## (type: Ident ## [Text Text]) ## [Functions] (do-template [ ] [(def: #export ( [module name]) (-> Ident Text) )] [module module] [name name] ) ## [Structures] (struct: #export _ (Eq Ident) (def: (= [xmodule xname] [ymodule yname]) (and (text/= xmodule ymodule) (text/= xname yname)))) (struct: #export _ (Codec Text Ident) (def: (encode [module name]) (case module "" name _ ($_ text/compose module "." name))) (def: (decode input) (if (text/= "" input) (#.Left (text/compose "Invalid format for Ident: " input)) (case (text.split-all-with "." input) (^ (list name)) (#.Right ["" name]) (^ (list module name)) (#.Right [module name]) _ (#.Left (text/compose "Invalid format for Ident: " input)))))) (struct: #export _ (Hash Ident) (def: eq Eq) (def: (hash [module name]) (let [(^open) text.Hash] (n/+ (hash module) (hash name)))))