Skip to content

Commit

Permalink
fix bug in elaboration that triggered a compiler panic
Browse files Browse the repository at this point in the history
  • Loading branch information
pa-ba committed Mar 7, 2024
1 parent e611382 commit 10a8320
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions examples/gui/src/AsyncRattus/Widgets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ mkTextField :: Sig Text -> Sig Color -> C TextField
mkTextField t c = do ch <- chan
return (TextField {tfInput = ch, tfText = t, tfColor = c})


mkTextField' :: Text -> Sig Color -> C TextField
mkTextField' t c = do ch <- chan
return (TextField {tfInput = ch, tfText = t ::: mkSig (box (wait ch)), tfColor = c})

btnOnClick :: Button -> Box (O ())
btnOnClick btn = let ch = btnClick btn
in box (wait ch)
Expand Down
2 changes: 1 addition & 1 deletion examples/gui/src/GUI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ isNumberText = Text.all isDigit
-- Textfield that turns red if the text is not a natural number
mkNumberTf :: C TextField
mkNumberTf = do
tf <- mkTextField (const "number") (const black)
tf <- mkTextField' "number" (const black)

let sig = (mkSig (tfOnInput tf))

Expand Down
4 changes: 2 additions & 2 deletions src/AsyncRattus/Plugin/Transform.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ transform' ctx (Case e b t alts) = do
let firstPrimInfo = foldl (\acc (p, _) -> acc <|> p) primInfo transformed
let alts' = map snd transformed
return (Case expr b t alts', firstPrimInfo)
transform' ctx (Cast e _) = transform' ctx e
transform' ctx (Tick _ e) = transform' ctx e
transform' ctx (Cast e c) = do (e' , p) <- transform' ctx e; return (Cast e' c, p)
transform' ctx (Tick t e) = do (e' , p) <- transform' ctx e; return (Tick t e', p)
transform' _ e = return (e, Nothing)

constructClockExtractionCode :: PrimInfo -> CoreM CoreExpr
Expand Down

0 comments on commit 10a8320

Please sign in to comment.