Ticket #3212 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

getOptions'.parseLanguage(2) went past eof token

Reported by: Jig Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.10.2
Keywords: getOptions'.parseLanguage(2) XFlexibleContexts Cc:
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar) (diff)

{-# LANGUAGE -XFlexibleContexts #-}
module Pngloadtest where
import Control.Monad
import Control.Arrow
import Codec.Image.PNG
import Data.Array.MArray
import Data.Array.Storable
import GHC.Word
--import Data.Array.MArray
import qualified Data.Matrix.DenseMatrix as DM

openImage :: IO PNGImage
openImage = do
  a <- loadPNGFile "C:/users/saftarn/desktop/datasets/pics/face2.png"
  case a of Left err  -> error err
            Right img -> return img

dims :: PNGImage -> (Int, Int)
dims img = join (***) fromIntegral $ dimensions img 

size :: PNGImage -> Int
size img = uncurry (*) $ dims img 


--imgToList :: (MArray StorableArray Word8 m, Num b) => PNGImage -> m [b]
imgToList img = do
  es <- getElems $ imageData img
  return $ map fromIntegral es

imgToMatrix :: (MArray StorableArray Word8 m) => PNGImage -> 
               m DM.DenseMatrix
imgToMatrix im = do
  let (w,_) = dims im
  xs <- imgToList im
  return $ DM.fromFlatList w xs

main = do
  im <- openImage
  a <- imgToList im
  print $ dims im
  print $ size im
  --print a





*Pngloadtest> :load "ComputerVision/Pngloadtest.hs"
[1 of 2] Compiling Data.Matrix.DenseMatrix ( Data\Matrix\DenseMatrix.hs, interpreted )
[2 of 2] Compiling Pngloadtest      ( ComputerVision\Pngloadtest.hs, interpreted )

ComputerVision\Pngloadtest.hs:29:0:
    Non type-variable argument
      in the constraint: MArray StorableArray Word8 m
    (Use -XFlexibleContexts to permit this)
    In the type signature for `imgToMatrix':
      imgToMatrix :: (MArray StorableArray Word8 m) =>
                     PNGImage -> m DM.DenseMatrix
Failed, modules loaded: Data.Matrix.DenseMatrix.
*Data.Matrix.DenseMatrix> :load "ComputerVision/Pngloadtest.hs"
: panic! (the 'impossible' happened)
  (GHC version 6.10.2 for i386-unknown-mingw32):
	getOptions'.parseLanguage(2) went past eof token

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

> 

Works if using: {-# LANGUAGE FlexibleContexts? #-}

Change History

Changed 4 years ago by simonmar

  • difficulty set to Unknown
  • description modified (diff)

Changed 4 years ago by simonmar

  • status changed from new to closed
  • resolution set to duplicate

Thanks for the report; duplicate of #3153, fixed in HEAD.

~/scratch > ghc-testing2 -c 3212.hs

3212.hs:1:0:
    cannot parse LANGUAGE pragma: comma-separated list expected
Note: See TracTickets for help on using tickets.