summaryrefslogtreecommitdiff
path: root/utils/genprimopcode
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2020-04-22 22:40:58 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-23 18:33:21 -0400
commit2c23e2e37d6c937a425c53da643aec90bda01ef6 (patch)
treefafda34b379a6238e712085d38386a1762238297 /utils/genprimopcode
parent72da0c29cd7c336cdce3b36d1dd9e8b65a53afbd (diff)
downloadhaskell-2c23e2e37d6c937a425c53da643aec90bda01ef6.tar.gz
Include docs for non-primop entries in primops.txt as well
Diffstat (limited to 'utils/genprimopcode')
-rw-r--r--utils/genprimopcode/Main.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs
index 93291698b3..63b51b9f5d 100644
--- a/utils/genprimopcode/Main.hs
+++ b/utils/genprimopcode/Main.hs
@@ -388,6 +388,7 @@ getName PrimOpSpec{ name = n } = Just n
getName PrimVecOpSpec{ name = n } = Just n
getName PseudoOpSpec{ name = n } = Just n
getName PrimTypeSpec{ ty = TyApp tc _ } = Just (show tc)
+getName PrimVecTypeSpec{ ty = TyApp tc _ } = Just (show tc)
getName _ = Nothing
{- Note [Placeholder declarations]
@@ -790,15 +791,11 @@ gen_switch_from_attribs attrib_name fn_name (Info defaults entries)
gen_wired_in_docs :: Info -> String
gen_wired_in_docs (Info _ entries)
- = unlines $ catMaybes (map mkAlt (filter is_primop entries)) ++ [funName ++ " _ = Nothing"]
+ = "primOpDocs =\n [ " ++ intercalate "\n , " (catMaybes $ map mkDoc $ concatMap desugarVectorSpec entries) ++ "\n ]\n"
where
- mkAlt po | null (desc po) = Nothing
- | otherwise = Just (funName ++ " " ++ mkLHS po ++ " = Just " ++ show (unlatex (desc po)))
- mkLHS po = case vecOptions po of
- [] -> cons po
- _ -> "(" ++ cons po ++ " _ _ _)"
-
- funName = "primOpDocs"
+ mkDoc po | Just poName <- getName po
+ , not $ null $ desc po = Just $ show (poName, unlatex $ desc po)
+ | otherwise = Nothing
------------------------------------------------------------------
-- Create PrimOpInfo text from PrimOpSpecs -----------------------