mirror of
https://github.com/GaloisInc/cryptol.git
synced 2025-01-05 15:07:12 +03:00
Show information about precedence and fixity in the operator help. Fixes #391
This commit is contained in:
parent
09dc9b4655
commit
ecdb774abb
@ -113,9 +113,9 @@ data Command
|
||||
|
||||
-- | Command builder.
|
||||
data CommandDescr = CommandDescr
|
||||
{ cNames :: [String]
|
||||
, cBody :: CommandBody
|
||||
, cHelp :: String
|
||||
{ cNames :: [String]
|
||||
, cBody :: CommandBody
|
||||
, cHelp :: String
|
||||
}
|
||||
|
||||
instance Show CommandDescr where
|
||||
@ -770,6 +770,19 @@ helpCmd cmd
|
||||
<+> colon
|
||||
<+> pp (ifDeclSig)
|
||||
|
||||
let mbFix = ifDeclFixity `mplus`
|
||||
(guard ifDeclInfix >> return P.defaultFixity)
|
||||
case mbFix of
|
||||
Just f ->
|
||||
let msg = "Precedence " ++ show (P.fLevel f) ++ ", " ++
|
||||
(case P.fAssoc f of
|
||||
P.LeftAssoc -> "associates to the left."
|
||||
P.RightAssoc -> "associates to the right."
|
||||
P.NonAssoc -> "does not associate.")
|
||||
|
||||
in rPutStrLn ('\n' : msg)
|
||||
Nothing -> return ()
|
||||
|
||||
case ifDeclDoc of
|
||||
Just str -> rPutStrLn ('\n' : str)
|
||||
Nothing -> return ()
|
||||
|
Loading…
Reference in New Issue
Block a user