Ticket #5777 (new bug)

Opened 4 months ago

Last modified 6 weeks ago

core lint error with arrow notation and GADTs

Reported by: benmos Owned by:
Priority: normal Milestone: 7.4.2
Component: Compiler Version: 7.4.1-rc1
Keywords: arrows, GADTs Cc: ben@…, benjamin.moseley@…, abcz2.uprola@…
Operating System: MacOS X Architecture: x86
Type of failure: Compile-time crash Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

The following code panics GHC (with 7.0.3, 7.2 and 7.4.0.20111219):

{-# LANGUAGE Arrows, GADTs #-}
import Control.Arrow

data Value a where BoolVal :: Value Bool

class ArrowInit f where
    arrif :: f b -> ()

instance ArrowInit Value where
    arrif = proc BoolVal -> returnA -< ()
    -- arrif = arr (\BoolVal -> ())

I am attaching the -dcore-lint from 7.4.

Attachments

arrow-gadt-panic.txt Download (4.7 KB) - added by benmos 4 months ago.
Core Lint output
Test3.hs Download (284 bytes) - added by benmos 4 months ago.
Source file

Change History

Changed 4 months ago by benmos

Core Lint output

Changed 4 months ago by benmos

Source file

Changed 4 months ago by ross

  • summary changed from Panic with Arrow Notation and GADTs to core lint error with arrow notation and GADTs

Simplified version, avoiding classes:

{-# LANGUAGE Arrows, GADTs #-}
module ArrowBug5777 where

import Control.Arrow

data Value a where BoolVal :: Value Bool

arrif :: Value Bool -> ()
arrif = proc BoolVal -> returnA -< ()

Changed 4 months ago by benmos

The workaround is to move the GADT data constructor out of the 'proc' pattern and into a 'let':

data Value a where BoolVal :: Int -> Value Bool

arrif :: Value Bool -> Int
arrif = proc x -> do
          let BoolVal i = x
          returnA -< i

Changed 4 months ago by igloo

  • difficulty set to Unknown
  • milestone set to 7.4.2

Changed 6 weeks ago by danbst

  • cc abcz2.uprola@… added
Note: See TracTickets for help on using tickets.