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