Skip to content

COMPLETE pragma doesn't know about module name

COMPLETE pragma doesn't support disambiguation. It is not possible to resolve a name collision between a pattern synonym and a constructor:

{-# LANGUAGE PatternSynonyms #-}
module Main where

import Prelude as P

pattern Nothing :: Maybe a
pattern Nothing = P.Nothing

pattern Just1 :: a -> Maybe a
pattern Just1 a = Just a

{-# COMPLETE Just1, Nothing #-}

main :: IO ()
main = pure ()

error

Main.hs:12:21: error:
    Ambiguous occurrence ‘Nothing’
    It could refer to
       either ‘P.Nothing’,
              imported from ‘Prelude’ at Main.hs:4:1-19
              (and originally defined in ‘GHC.Maybe’)
           or ‘Main.Nothing’, defined at Main.hs:7:1
   |
12 | {-# COMPLETE Just1, Nothing #-}

Module name is not handled correctly

{-# LANGUAGE PatternSynonyms #-}
module Main where

import Prelude as P

pattern Nothing :: Maybe a
pattern Nothing = P.Nothing

pattern Just1 :: a -> Maybe a
pattern Just1 a = Just a

{-# COMPLETE Just1, Main.Nothing #-}

main :: IO ()
main = pure ()

error

Main.hs:12:21: error: parse error on input ‘Main.Nothing’
   |
12 | {-# COMPLETE Just1, Main.Nothing #-}
   |                     ^^^^^^^^^^^^

GHC 8.10.7

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