Weird typos fixed.

This commit is contained in:
Erik Svedäng 2018-03-27 14:14:30 +02:00
parent dd726410ed
commit c1e427688d
2 changed files with 16 additions and 7 deletions

View File

@ -17,11 +17,11 @@
(list 'macro-log (list 'meta name "sig")))
(doc hide "Mark a binding as hidden, this will make it not print with the 'info' command.")
(defmacro hide [name signature]
(defmacro hide [name]
(list 'meta-set! name "hide" true))
(doc private "Mark a binding as private, this will make it inaccessible from other modules.")
(defmacro private [name signature]
(defmacro private [name]
(list 'meta-set! name "private" true))
(doc private? "Is this binding private?")

View File

@ -267,6 +267,13 @@ newtype MetaData = MetaData { getMeta :: Map.Map String XObj } deriving (Eq, Sho
emptyMeta :: MetaData
emptyMeta = (MetaData Map.empty)
metaIsTrue :: MetaData -> String -> Bool
metaIsTrue metaData key =
case Map.lookup "hidden" (getMeta metaData) of
Just (XObj (Bol True) _ _) -> True
_ -> False
-- | Wraps and holds an XObj in an environment.
data Binder = Binder { binderMeta :: MetaData, binderXObj :: XObj } deriving Eq
@ -282,11 +289,13 @@ showBinderIndented indent (name, Binder _ (XObj (Lst [XObj (Interface t paths) _
replicate indent ' ' ++ name ++ " : " ++ show t ++ " = {\n " ++
joinWith "\n " (map show paths) ++
"\n" ++ replicate indent ' ' ++ "}"
showBinderIndented indent (name, Binder _ xobj) =
replicate indent ' ' ++ name ++
-- " (" ++ show (getPath xobj) ++ ")" ++
" : " ++ showMaybeTy (ty xobj)
-- ++ " <" ++ getBinderDescription xobj ++ ">"
showBinderIndented indent (name, Binder meta xobj) =
if metaIsTrue meta "hidden"
then ""
else replicate indent ' ' ++ name ++
-- " (" ++ show (getPath xobj) ++ ")" ++
" : " ++ showMaybeTy (ty xobj)
-- ++ " <" ++ getBinderDescription xobj ++ ">"
-- | Get a list of pairs from a deftype declaration.
memberXObjsToPairs :: [XObj] -> [(String, Ty)]