ghc-vis icon indicating copy to clipboard operation
ghc-vis copied to clipboard

GHC.Vis fails to build with GHC 8.0.1

Open taktoa opened this issue 7 years ago • 1 comments

When compiling with GHC 8.0.1 on NixOS, I have the following problems:

  1. The provided version bounds are too restrictive for my versions of base and transformers.
  2. There are two type errors, labelled Error 1 and Error 2 below, which seem to be result of the ImpredicativeTypes extension used in that file. It seems to me that there are two paths to fixing these errors: either add a type signature to the Nothing on line 228 and to the definition of withPNGSurface, or disable ImpredicativeTypes and fix another error, labelled Error 3 below. If you can compile without ImpredicativeTypes on GHC 7.10, I strongly suspect it will compile on GHC 8.0.1 without modification.

Error 1

src/GHC/Vis.hs:228:16: error:
    • Couldn't match type ‘forall a. Maybe a’ with ‘Maybe String’
      Expected type: IO (Maybe String)
        Actual type: IO (forall a. Maybe a)
    • In a stmt of a 'do' block: return Nothing
      In the expression:
        do { put $ ExportSignal ((\ (Left x) -> x) mbDrawFn) filename;
             return Nothing }
      In a case alternative:
          Left _
            -> do { put $ ExportSignal ((\ (Left x) -> x) mbDrawFn) filename;
                    return Nothing }

Error 2

src/GHC/Vis.hs:233:22: error:
    • Couldn't match type ‘forall a a1 a2.
                           (RealFrac a2, RealFrac a1) =>
                           FilePath -> a1 -> a2 -> (Surface -> IO a) -> IO a’
                     with ‘forall a.
                           FilePath -> Double -> Double -> (Surface -> IO a) -> IO a’
      Expected type: Either
                       (forall a.
                        FilePath -> Double -> Double -> (Surface -> IO a) -> IO a)
                       b
        Actual type: Either
                       (forall a a1 a2.
                        (RealFrac a2, RealFrac a1) =>
                        FilePath -> a1 -> a2 -> (Surface -> IO a) -> IO a)
                       b
    • In the expression: Left withPNGSurface
      In a case alternative: ".png" -> Left withPNGSurface
      In the expression:
        case map toLower (reverse . take 4 . reverse $ filename) of {
          ".svg" -> Left withSVGSurface
          ".pdf" -> Left withPDFSurface
          ".png" -> Left withPNGSurface
          _ : ".ps" -> Left withPSSurface
          _ -> Right
                 "Unknown file extension, try one of the following: .svg, .pdf, .ps, .png" }

Error 3

src/GHC/Vis.hs:569:29: error:
    • Couldn't match type ‘DrawFunction’
                     with ‘FilePath -> Double -> Double -> (Surface -> IO a0) -> IO a0’
      Expected type: View
                     -> (FilePath -> Double -> Double -> (Surface -> IO a0) -> IO a0)
                     -> String
                     -> IO ()
        Actual type: View -> DrawFunction -> String -> IO ()
    • In the first argument of ‘runCorrect’, namely ‘exportView’
      In the first argument of ‘(>>=)’, namely ‘runCorrect exportView’
      In the first argument of ‘catch’, namely
        ‘(runCorrect exportView >>= \ e -> e d f)’

taktoa avatar Oct 16 '16 07:10 taktoa

I've already gotten ghc-vis to compile with GHC 8 but the result when run doesn't seem to work (at least on Mac OS X). Can you verify this? https://github.com/FranklinChen/ghc-vis/tree/ghc-8

FranklinChen avatar Oct 16 '16 15:10 FranklinChen