git.iko.soy/rowtype-yoga/purescript-backend-optimizer
on main help sign in
30 lines 855 B history raw
1-- @inline export watUnit(..).wat1 arity=1
2-- @inline export watUnit(..).wat2 arity=1
3-- @inline export testImpl never
4module Snapshot.InlineDirectivePropSpine02 where
6import Prelude
8import Type.Equality (class TypeEquals)
9import Type.Equality as TypeEquals
11testImpl :: Unit -> Unit
12testImpl = identity
14class Wat a b | b -> a where
15 wat1 :: a -> b
16 wat2 :: a -> b
18instance watUnit :: TypeEquals a Unit => Wat a Unit where
19 wat1 = testImpl <<< TypeEquals.to
20 wat2 = testImpl <<< TypeEquals.to
22-- This results in a partially applied call for `watUnit` specialized
23-- to `Unit` TypeEquals dictionary. Without the directive, This
24-- won't inline via heuristics since it's a CAF. With the directive,
25-- test1 and test2 get inlined to calls to testImpl.
26f = wat1 :: Unit -> Unit
27g = wat2 :: Unit -> Unit
29test1 = f unit :: Unit
30test2 = g unit :: Unit