Opened 2 weeks ago

Closed 13 days ago

#13671 closed bug (worksforme)

Core lint error with PatternSynonyms and undefined

Reported by: Iceland_jack Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: PatternSynonyms Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I've submitted quite a few Core Lint errors lately, I don't have access to GHC HEAD so ignore this ticket if this has already been resolved

{-# Options_GHC -dcore-lint #-}

{-# Language ViewPatterns, PatternSynonyms #-}

import Data.Bifunctor.Fix
import Data.Bifunctor.Tannen

newtype ZipList a = ZL { getZipList :: Fix (Tannen Maybe (,)) a }

pattern Nil :: ZipList a
pattern Nil = ZL (In (Tannen Nothing))

infixr 5 :::
pattern (:::) :: a -> ZipList a -> ZipList a
pattern a:::as <- ZL (In (Tannen (undefined -> (a, as))))
  where a:::as = undefined 

works fine without -dcore-lint but fails with it.

Works fine if undefined -> (a, as) is replaced with let x = x in x -> (a, as).

Attachments (1)

tQdW.log (6.9 KB) - added by Iceland_jack 13 days ago.

Download all attachments as: .zip

Change History (2)

Changed 13 days ago by Iceland_jack

Attachment: tQdW.log added

comment:1 Changed 13 days ago by simonpj

Resolution: worksforme
Status: newclosed

I don't know precisely which Data.Bifunctor.Fix etc you mean, but I tried this

{-# Options_GHC -dcore-lint #-}
{-# Language ViewPatterns, PatternSynonyms #-}

module T13671 where


newtype ZipList a = ZL { getZipList :: Fix (Tannen Maybe (,)) a }

pattern Nil :: ZipList a
pattern Nil = ZL (In (Tannen Nothing))

infixr 5 :::
pattern (:::) :: a -> ZipList a -> ZipList a
pattern a:::as <- ZL (In (Tannen (undefined -> (a, as))))
  where a:::as = undefined

newtype Tannen f p a b = Tannen { runTannen :: f (p a b) }
newtype Fix p a = In { out :: p (Fix p a) a }

That compiles fine with -dcore-lint. So I'll close.

Note: See TracTickets for help on using tickets.