Skip to content

Give seq a more precise type and remove some magic

Ben Gamari requested to merge wip/T17440 into master

GHC.Prim.seq previously had the rather plain type:

seq :: forall a b. a -> b -> b

However, it also had a special typing rule to applications where b is not of kind Type.

#17440 (closed) noted that levity polymorphism allows us to rather give it the more precise type:

seq :: forall (r :: RuntimeRep) a (b :: TYPE r). a -> b -> b

This allows us to remove the special typing rule that we previously required to allow applications on unlifted arguments. T9404 contains a non-Type application of seq which should verify that this works as expected.

Note that this only handles the typing facets of #17440 (closed). There are still a number of other things that need to be done in this area.

Closes #17440 (closed).

Edited by Ben Gamari

Merge request reports