Skip to content

Unhelpful error message when passing uni-directional pattern synonyms to :t

Assume the following module is loaded.

module Rand where

pattern UniJust x <- Just x

If you ask GHCi for its type using the :t command, it will show the following error:

<interactive>:1:1-7: error: [GHC-16444]
• non-bidirectional pattern synonym ‘UniJust’ used in an expression
• In the expression: UniJust

But if you use the :info command, it is happy to show you the type:

pattern UniJust :: forall {a}. a -> Maybe a 	-- Defined in ‘Rand’

As Richard Suggest's, it would be much more helpful if the error message suggested the use of the :info command instead.

GHC versions used: 9.10.1, 9.8.2, 9.6.5

Edited by Artin Ghasivand
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information