Ticket #3964 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Impossible happened when using ViewPattern in Arrows

Reported by: uzytkownik Owned by: simonpj
Priority: high Milestone: 6.12.3
Component: Compiler Version: 6.12.1
Keywords: Cc: uzytkownik2@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Compile-time crash Difficulty:
Test Case: arrows/should_compile/T3964 Blocked By:
Blocking: Related Tickets:

Description (last modified by igloo) (diff)

When I try to load file in ghci impossible happened:

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.1 for x86_64-unknown-linux):
	collectl/go
    ((=={v aOp} [lid]
      u{v avw} [lid]) -> {229:56-59}{229:56-59}ghc-prim:GHC.Bool.True{(w) d 6u})

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Problematic function:

isOn :: ArrowChoice a => DSignal a c -> SF a b (Maybe c)                        
isOn (DSignal _ f u) = let sf = SF $! \_ -> proc (_, s, e) ->                   
                             case fromDynamic (_payload e) of                   
                                 Just (Event ((== u) -> True) v) ->             
                                     returnA -< (Just (f v), s, sf)             
                                 Nothing -> returnA -< (Nothing, s, sf)         
                       in sf

(Full sources will be attached. As it was found in-development so style may not be perfect)

Attachments

SF.hs Download (1.2 KB) - added by uzytkownik 3 years ago.
Current minimal file in which problem was detected

Change History

Changed 3 years ago by uzytkownik

Current minimal file in which problem was detected

Changed 3 years ago by uzytkownik

  • cc uzytkownik2@… added

Updated panic for minimized file:

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.1 for x86_64-unknown-linux):
	collectl/go
    ((=={v axe} [lid]
      u{v amk} [lid]) -> {31:56-59}{31:56-59}ghc-prim:GHC.Bool.True{(w) d 6u})

Changed 3 years ago by uzytkownik

  • summary changed from Impossible happened to Impossible happened when using ViewPattern in Arrows

If I change the ViewPattern? into if the problem does not occure.

Changed 3 years ago by uzytkownik

Even more simplifized example:

{-# LANGUAGE Arrows #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Arrow

testF :: Eq a => a -> (Maybe (Maybe a)) -> Maybe a
testF v = proc x -> case x of
    Just (Just ((==v) -> True)) -> returnA -< Just v
    _                           -> returnA -< Nothing
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.1 for x86_64-unknown-linux):
	collectl/go
    ((=={v agq} [lid]
      v{v afv} [lid]) -> {8:25-28}{8:25-28}ghc-prim:GHC.Bool.True{(w) d 6u})

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

Changed 3 years ago by simonpj

  • owner set to simonpj

Fixing this. Simon

Changed 3 years ago by igloo

  • description modified (diff)

Changed 3 years ago by igloo

  • priority changed from normal to high
  • milestone set to 6.12.3

Thanks for a great testcase!

Changed 3 years ago by simonpj

  • status changed from new to merge
  • testcase set to arrows/should_compile/T3964

Great report thanks. Fixed by

Fri Apr  9 17:55:57 BST 2010  simonpj@microsoft.com
  * Fix Trac #3964: view patterns in DsArrows
  
  Just a missing case; I've eliminated the catch-all so 
  that we get a warning next time we extend HsPat

    M ./compiler/deSugar/DsArrows.lhs -1 +2

Maybe merge to 6.12.3

Simon

Changed 3 years ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Merged.

Note: See TracTickets for help on using tickets.