leventov / yarr

Yer another array library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not build with fixed-vector 0.7.0.0

idontgetoutmuch opened this issue · comments

If you recall, I managed to get yarr to build under 7.8.3. That’s the good news.

I then tried to get it included in stackage. Quite reasonably Michael Snoyman tells me that I need to use the latest version of fixed-vector (0.7.0.0). yarr currently specifies 0.1.2.1.

I changed the constraint in the .cabal file to >= 0.7.0.0 && < 0.8.0.0 and got compilation errors (not surprisingly).

  1. Data.Vector.Fixed.Internal has disappeared but I found the functions required from it in different modules.

    import Data.Vector.Fixed.Mutable ( inspectVec )
    import Data.Vector.Fixed.Cont ( accum )

I think this should be ok.

  1. There is no longer a constructor called VecList.

    Data/Yarr/Utils/FixedVector/InlinableArity.hs:39:26:
    Not in scope: data constructor ‘VecList’
    In the Template Haskell quotation
    [| convert $ VecList ($(listE vs)) |]

The source for the full module is here: https://github.com/leventov/yarr/blob/master/yarr/Data/Yarr/Utils/FixedVector/InlinableArity.hs

It’s not clear to me how to fix this without affecting performance. There are now constructors Nil and Cons.

data VecList n a where
  Nil  :: VecList Z a
  Cons :: a -> VecList n a -> VecList (S n) a
  deriving (Typeable)

Do you have any suggestions on what I should do?

This does this job

   construct' vs =
       [| convert $(foldr (\x xs -> [|Cons|] `appE` x `appE` xs) [|Nil|] vs) |]

With the changes so far:

d97e442

we now get

[29 of 31] Compiling Data.Yarr.Convolution.StaticStencils ( Data/Yarr/Convolution/StaticStencils.hs, dist/build/Data/Yarr/Convolution/StaticStencils.o )

Data/Yarr/Convolution/StaticStencils.hs:178:17:
    Could not deduce (s
                      ~ Data.Vector.Fixed.Mutable.DimM
                          (Data.Vector.Fixed.Mutable.Mutable (VecList s)))
    from the context (USource r l Dim1 a, StencilOffsets s so eo)
      bound by the type signature for
                 convolveDim1WithStaticStencil :: (USource r l Dim1 a,
                                                   StencilOffsets s so eo) =>
                                                  (UArray r l Dim1 a -> Dim1 -> Dim1 -> IO a)
                                                  -> Dim1Stencil s a b c
                                                  -> UArray r l Dim1 a
                                                  -> UArray CV CVL Dim1 c
      at Data/Yarr/Convolution/StaticStencils.hs:(158,8)-(166,27)
      ‘s’ is a rigid type variable bound by
          the type signature for
            convolveDim1WithStaticStencil :: (USource r l Dim1 a,
                                              StencilOffsets s so eo) =>
                                             (UArray r l Dim1 a -> Dim1 -> Dim1 -> IO a)
                                             -> Dim1Stencil s a b c
                                             -> UArray r l Dim1 a
                                             -> UArray CV CVL Dim1 c
          at Data/Yarr/Convolution/StaticStencils.hs:158:19
    Relevant bindings include
      stencil :: VecList s b
        (bound at Data/Yarr/Convolution/StaticStencils.hs:169:36)
      convolveDim1WithStaticStencil :: (UArray r l Dim1 a
                                        -> Dim1 -> Dim1 -> IO a)
                                       -> Dim1Stencil s a b c
                                       -> UArray r l Dim1 a
                                       -> UArray CV CVL Dim1 c
        (bound at Data/Yarr/Convolution/StaticStencils.hs:168:1)
    In a stmt of a 'do' block:
      iifoldM
        (- startOff)
        succ
        (\ acc i b
           -> do { a <- get (ix + i);
                   reduce acc a b })
        z
        stencil
    In the expression:
      do { z <- mz;
           iifoldM
             (- startOff)
             succ
             (\ acc i b
                -> do { a <- get (ix + i);
                        .... })
             z
             stencil }
    In the expression:
      \ ix
        -> do { z <- mz;
                iifoldM (- startOff) succ (\ acc i b -> ...) z stencil }

Data/Yarr/Convolution/StaticStencils.hs:258:17:
    sCould not deduce (sy
                      ~ Data.Vector.Fixed.Mutable.DimM
                          (Data.Vector.Fixed.Mutable.Mutable (VecList sy)))
    from the context (USource r SH Dim2 a,
                      StencilOffsets sx sox eox,
                      StencilOffsets sy soy eoy)
      bound by the type signature for
                 convolveShDim2WithStaticStencil :: (USource r SH Dim2 a,
                                                     StencilOffsets sx sox eox,
                                                     StencilOffsets sy soy eoy) =>
                                                    (UArray r SH Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                    -> Dim2Stencil sx sy a b c
                                                    -> UArray r SH Dim2 a
                                                    -> UArray CV CVL Dim2 c
      at Data/Yarr/Convolution/StaticStencils.hs:(234,8)-(243,27)
      ‘sy’ is a rigid type variable bound by
           the type signature for
             convolveShDim2WithStaticStencil :: (USource r SH Dim2 a,
                                                 StencilOffsets sx sox eox,
                                                 StencilOffsets sy soy eoy) =>
                                                (UArray r SH Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                -> Dim2Stencil sx sy a b c
                                                -> UArray r SH Dim2 a
                                                -> UArray CV CVL Dim2 c
           at Data/Yarr/Convolution/StaticStencils.hs:234:28
    Relevant bindings include
      stencil :: VecList sy (VecList sx b)
        (bound at Data/Yarr/Convolution/StaticStencils.hs:246:38)
      convolveShDim2WithStaticStencil :: (UArray r SH Dim2 a
                                          -> Dim2 -> Dim2 -> IO a)
                                         -> Dim2Stencil sx sy a b c
                                         -> UArray r SH Dim2 a
                                         -> UArray CV CVL Dim2 c
        (bound at Data/Yarr/Convolution/StaticStencils.hs:245:1)
    In a stmt of a 'do' block:
      iifoldM
        (- startOffY)
        succ
        (\ acc iy xv
           -> iifoldM
                (- startOffX)
                succ
                (\ acc ix b
                   -> do { a <- get (y + iy, x + ix);
                           reduce acc a b })
                acc
                xv)
        z
        stencil
    In the expression:
      do { z <- mz;
           iifoldM
             (- startOffY)
             succ
             (\ acc iy xv
                -> iifoldM (- startOffX) succ (\ acc ix b -> do { ... }) acc xv)
             z
             stencil }
    In the expression:
      \ (y, x)
        -> do { z <- mz;
                iifoldM
                  (- startOffY)
                  succ
                  (\ acc iy xv
                     -> iifoldM (- startOffX) succ (\ acc ix b -> ...) acc xv)
                  z
                  stencil }

Data/Yarr/Convolution/StaticStencils.hs:262:25:
    Could not deduce (sx
                      ~ Data.Vector.Fixed.Mutable.DimM
                          (Data.Vector.Fixed.Mutable.Mutable (VecList sx)))
    from the context (USource r SH Dim2 a,
                      StencilOffsets sx sox eox,
                      StencilOffsets sy soy eoy)
      bound by the type signature for
                 convolveShDim2WithStaticStencil :: (USource r SH Dim2 a,
                                                     StencilOffsets sx sox eox,
                                                     StencilOffsets sy soy eoy) =>
                                                    (UArray r SH Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                    -> Dim2Stencil sx sy a b c
                                                    -> UArray r SH Dim2 a
                                                    -> UArray CV CVL Dim2 c
      at Data/Yarr/Convolution/StaticStencils.hs:(234,8)-(243,27)
      ‘sx’ is a rigid type variable bound by
           the type signature for
             convolveShDim2WithStaticStencil :: (USource r SH Dim2 a,
                                                 StencilOffsets sx sox eox,
                                                 StencilOffsets sy soy eoy) =>
                                                (UArray r SH Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                -> Dim2Stencil sx sy a b c
                                                -> UArray r SH Dim2 a
                                                -> UArray CV CVL Dim2 c
           at Data/Yarr/Convolution/StaticStencils.hs:234:17
    Relevant bindings include
      xv :: VecList sx b
        (bound at Data/Yarr/Convolution/StaticStencils.hs:261:30)
      stencil :: VecList sy (VecList sx b)
        (bound at Data/Yarr/Convolution/StaticStencils.hs:246:38)
      convolveShDim2WithStaticStencil :: (UArray r SH Dim2 a
                                          -> Dim2 -> Dim2 -> IO a)
                                         -> Dim2Stencil sx sy a b c
                                         -> UArray r SH Dim2 a
                                         -> UArray CV CVL Dim2 c
        (bound at Data/Yarr/Convolution/StaticStencils.hs:245:1)
    In the expression:
      iifoldM
        (- startOffX)
        succ
        (\ acc ix b
           -> do { a <- get (y + iy, x + ix);
                   reduce acc a b })
        acc
        xv
    In the third argument of ‘iifoldM’, namely
      ‘(\ acc iy xv
          -> iifoldM
               (- startOffX)
               succ
               (\ acc ix b
                  -> do { a <- get (y + iy, x + ix);
                          reduce acc a b })
               acc
               xv)’
    In a stmt of a 'do' block:
      iifoldM
        (- startOffY)
        succ
        (\ acc iy xv
           -> iifoldM
                (- startOffX)
                succ
                (\ acc ix b
                   -> do { a <- get (y + iy, x + ix);
                           reduce acc a b })
                acc
                xv)
        z
        stencil

Data/Yarr/Convolution/StaticStencils.hs:320:17:
    Could not deduce (sy
                      ~ Data.Vector.Fixed.Mutable.DimM
                          (Data.Vector.Fixed.Mutable.Mutable (VecList sy)))
    from the context (StencilOffsets sx sox eox,
                      StencilOffsets sy soy eoy,
                      USource r L Dim2 a)
      bound by the type signature for
                 convolveLinearDim2WithStaticStencil :: (StencilOffsets sx sox eox,
                                                         StencilOffsets sy soy eoy,
                                                         USource r L Dim2 a) =>
                                                        (UArray r L Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                        -> Dim2Stencil sx sy a b c
                                                        -> UArray r L Dim2 a
                                                        -> UArray CV CVL Dim2 c
      at Data/Yarr/Convolution/StaticStencils.hs:(296,8)-(305,27)
      ‘sy’ is a rigid type variable bound by
           the type signature for
             convolveLinearDim2WithStaticStencil :: (StencilOffsets sx sox eox,
                                                     StencilOffsets sy soy eoy,
                                                     USource r L Dim2 a) =>
                                                    (UArray r L Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                    -> Dim2Stencil sx sy a b c
                                                    -> UArray r L Dim2 a
                                                    -> UArray CV CVL Dim2 c
           at Data/Yarr/Convolution/StaticStencils.hs:296:28
    Relevant bindings include
      stencil :: VecList sy (VecList sx b)
        (bound at Data/Yarr/Convolution/StaticStencils.hs:308:38)
      convolveLinearDim2WithStaticStencil :: (UArray r L Dim2 a
                                              -> Dim2 -> Dim2 -> IO a)
                                             -> Dim2Stencil sx sy a b c
                                             -> UArray r L Dim2 a
                                             -> UArray CV CVL Dim2 c
        (bound at Data/Yarr/Convolution/StaticStencils.hs:307:1)
    In a stmt of a 'do' block:
      iifoldM
        (- startOffY)
        succ
        (\ acc iy xv
           -> iifoldM
                (- startOffX)
                succ
                (\ acc ix b
                   -> do { a <- get (y + iy, x + ix);
                           reduce acc a b })
                acc
                xv)
        z
        stencil
    In the expression:
      do { z <- mz;
           iifoldM
             (- startOffY)
             succ
             (\ acc iy xv
                -> iifoldM (- startOffX) succ (\ acc ix b -> do { ... }) acc xv)
             z
             stencil }
    In the expression:
      \ (y, x)
        -> do { z <- mz;
                iifoldM
                  (- startOffY)
                  succ
                  (\ acc iy xv
                     -> iifoldM (- startOffX) succ (\ acc ix b -> ...) acc xv)
                  z
                  stencil }

Data/Yarr/Convolution/StaticStencils.hs:324:25:
    Could not deduce (sx
                      ~ Data.Vector.Fixed.Mutable.DimM
                          (Data.Vector.Fixed.Mutable.Mutable (VecList sx)))
    from the context (StencilOffsets sx sox eox,
                      StencilOffsets sy soy eoy,
                      USource r L Dim2 a)
      bound by the type signature for
                 convolveLinearDim2WithStaticStencil :: (StencilOffsets sx sox eox,
                                                         StencilOffsets sy soy eoy,
                                                         USource r L Dim2 a) =>
                                                        (UArray r L Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                        -> Dim2Stencil sx sy a b c
                                                        -> UArray r L Dim2 a
                                                        -> UArray CV CVL Dim2 c
      at Data/Yarr/Convolution/StaticStencils.hs:(296,8)-(305,27)
      ‘sx’ is a rigid type variable bound by
           the type signature for
             convolveLinearDim2WithStaticStencil :: (StencilOffsets sx sox eox,
                                                     StencilOffsets sy soy eoy,
                                                     USource r L Dim2 a) =>
                                                    (UArray r L Dim2 a -> Dim2 -> Dim2 -> IO a)
                                                    -> Dim2Stencil sx sy a b c
                                                    -> UArray r L Dim2 a
                                                    -> UArray CV CVL Dim2 c
           at Data/Yarr/Convolution/StaticStencils.hs:296:17
    Relevant bindings include
      xv :: VecList sx b
        (bound at Data/Yarr/Convolution/StaticStencils.hs:323:30)
      stencil :: VecList sy (VecList sx b)
        (bound at Data/Yarr/Convolution/StaticStencils.hs:308:38)
      convolveLinearDim2WithStaticStencil :: (UArray r L Dim2 a
                                              -> Dim2 -> Dim2 -> IO a)
                                             -> Dim2Stencil sx sy a b c
                                             -> UArray r L Dim2 a
                                             -> UArray CV CVL Dim2 c
        (bound at Data/Yarr/Convolution/StaticStencils.hs:307:1)
    In the expression:
      iifoldM
        (- startOffX)
        succ
        (\ acc ix b
           -> do { a <- get (y + iy, x + ix);
                   reduce acc a b })
        acc
        xv
    In the third argument of ‘iifoldM’, namely
      ‘(\ acc iy xv
          -> iifoldM
               (- startOffX)
               succ
               (\ acc ix b
                  -> do { a <- get (y + iy, x + ix);
                          reduce acc a b })
               acc
               xv)’
    In a stmt of a 'do' block:
      iifoldM
        (- startOffY)
        succ
        (\ acc iy xv
           -> iifoldM
                (- startOffX)
                succ
                (\ acc ix b
                   -> do { a <- get (y + iy, x + ix);
                           reduce acc a b })
                acc
                xv)
        z
        stencil

Thanks to @leventov and @Shimuuar this now compiles with ghc 7.8.3 and fixed-vector 0.7.0.0.