@@ -20,6 +20,10 @@ esForeignSemantics = Map.fromFoldable semantics
2020 , data_bounded_topChar
2121 , data_bounded_bottomChar
2222 , data_enum_toCharCode
23+ , data_show_showCharImpl
24+ , data_show_showIntImpl
25+ , data_show_showNumberImpl
26+ , data_show_showStringImpl
2327 ]
2428
2529data_bounded_topInt :: ForeignSemantics
@@ -51,6 +55,33 @@ data_enum_toCharCode = Tuple (qualified "Data.Enum" "toCharCode") go
5155 _ ->
5256 Nothing
5357
58+data_show_showStringImpl :: ForeignSemantics
59+data_show_showStringImpl = Tuple (qualified "Data.Show" "showStringImpl") $ showLit case _ of
60+ NeutLit (LitString n) -> Just n
61+ _ -> Nothing
62+
63+data_show_showIntImpl :: ForeignSemantics
64+data_show_showIntImpl = Tuple (qualified "Data.Show" "showIntImpl") $ showLit case _ of
65+ NeutLit (LitInt n) -> Just n
66+ _ -> Nothing
67+
68+data_show_showNumberImpl :: ForeignSemantics
69+data_show_showNumberImpl = Tuple (qualified "Data.Show" "showNumberImpl") $ showLit case _ of
70+ NeutLit (LitNumber n) -> Just n
71+ _ -> Nothing
72+
73+data_show_showCharImpl :: ForeignSemantics
74+data_show_showCharImpl = Tuple (qualified "Data.Show" "showCharImpl") $ showLit case _ of
75+ NeutLit (LitChar n) -> Just n
76+ _ -> Nothing
77+
78+showLit :: forall a. Show a => (BackendSemantics -> Maybe a) -> ForeignEval
79+showLit match _ _ = case _ of
80+ [ ExternApp [ sem ] ] | Just val <- match sem ->
81+ Just $ NeutLit $ LitString (show val)
82+ _ ->
83+ Nothing
84+
5485litInt :: Int -> BackendSemantics
5586litInt = NeutLit <<< LitInt
5687