Lara Michaels | 28 Jun 2012 20:11
Picon
Favicon
Gravatar

is there a way to build xmonad-contrib 0.9.2 on a system with ghc 7.4.1?

Hi

I would like to install xmonad 0.9.2 (which worked fine for me) on my Ubuntu 12.04 system (GHC 7.4.1).

Following the instructions on README, xmonad-0.9.2 compiles fine but xmonad-contrib-0.9.2 fails at the
build stage:
[101 of 180] Compiling XMonad.Layout.MouseResizableTile ( XMonad/Layout/MouseResizableTile.hs,
dist/build/XMonad/Layout/MouseResizableTile.o )

XMonad/Layout/MouseResizableTile.hs:182:17:
    Could not deduce (Eq t) arising from the literal `0'
    from the context (Num t)
      bound by the type signature for
                 replaceAtPos :: Num t => [Rational] -> t -> Rational -> [Rational]
      at XMonad/Layout/MouseResizableTile.hs:(182,1)-(185,61)
    Possible fix:
      add (Eq t) to the context of
        the type signature for
          replaceAtPos :: Num t => [Rational] -> t -> Rational -> [Rational]
    In the pattern: 0
    In an equation for `replaceAtPos': replaceAtPos [] 0 x' = [x']
cabal: Error: some packages failed to install:
xmonad-contrib-0.9.2 failed during the building phase. The exception was:
ExitFailure 1

Is there a way to get this to build on my system?

thank you for any help

~l
(Continue reading)

Brandon Allbery | 28 Jun 2012 20:30
Picon
Gravatar

Re: is there a way to build xmonad-contrib 0.9.2 on a system with ghc 7.4.1?

On Thu, Jun 28, 2012 at 2:11 PM, Lara Michaels <laramichaels1978-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:
I would like to install xmonad 0.9.2 (which worked fine for me) on my Ubuntu 12.04 system (GHC 7.4.1).

If you're having problems with 0.10, perhaps we should be examining the diffs between the two to see what changed and why. (Although "why" isn't always explained; not all programmers comment or document as well as they should.)
 
XMonad/Layout/MouseResizableTile.hs:182:17:
    Could not deduce (Eq t) arising from the literal `0'
    from the context (Num t)
      bound by the type signature for
                 replaceAtPos :: Num t => [Rational] -> t -> Rational -> [Rational]
      at XMonad/Layout/MouseResizableTile.hs:(182,1)-(185,61)
    Possible fix:
      add (Eq t) to the context of

It's telling you exactly how to fix it.

Num used to imply Eq and Show, but no longer does; as such, those constraints may need to be added in some places where pre-7.2 compiled things without error.  In this case we don't need Show but do need Eq.

    cabal unpack xmonad-contrib-0.9.2
    vi -n +182 XMonad/Layout/MouseResizableTile.c
    # or use your favorite editor to change "Num t =>" to "(Num t, Eq t) =>"
    cabal install # no package name here; it will build and install the package in the current directory

--
brandon s allbery                                      allbery.b <at> gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms

<div><div dir="ltr">On Thu, Jun 28, 2012 at 2:11 PM, Lara Michaels <span dir="ltr">&lt;<a href="mailto:laramichaels1978@..." target="_blank">laramichaels1978@...</a>&gt;</span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote">
I would like to install xmonad 0.9.2 (which worked fine for me) on my Ubuntu 12.04 system (GHC 7.4.1).<br>
</blockquote>
<div><br></div>
<div>If you're having problems with 0.10, perhaps we should be examining the diffs between the two to see what changed and why. (Although "why" isn't always explained; not all programmers comment or document as well as they should.)</div>
<div>&nbsp;</div>
<blockquote class="gmail_quote">XMonad/Layout/MouseResizableTile.hs:182:17:<br>
&nbsp;&nbsp;&nbsp; Could not deduce (Eq t) arising from the literal `0'<br>
&nbsp;&nbsp;&nbsp; from the context (Num t)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bound by the type signature for<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; replaceAtPos :: Num t =&gt; [Rational] -&gt; t -&gt; Rational -&gt; [Rational]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at XMonad/Layout/MouseResizableTile.hs:(182,1)-(185,61)<br>
&nbsp;&nbsp;&nbsp; Possible fix:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add (Eq t) to the context of<br>
</blockquote>
<div><br></div>
<div>It's telling you exactly how to fix it.</div>
<div><br></div>
<div>Num used to imply Eq and Show, but no longer does; as such, those constraints may need to be added in some places where pre-7.2 compiled things without error. &nbsp;In this case we don't need Show but do need Eq.</div>
<div><br></div>
<div>&nbsp; &nbsp; cabal unpack xmonad-contrib-0.9.2</div>
<div>&nbsp; &nbsp; vi -n +182 XMonad/Layout/MouseResizableTile.c</div>
<div>&nbsp; &nbsp; # or use your favorite editor to change "Num t =&gt;" to "(Num t, Eq t) =&gt;"</div>
<div>&nbsp; &nbsp; cabal install # no package name here; it will build and install the package in the current directory</div>
<div><br></div>
</div>-- <br>brandon s allbery &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:allbery.b@..." target="_blank">allbery.b <at> gmail.com</a><br>
wandering unix systems administrator (available) &nbsp; &nbsp; (412) 475-9364 vm/sms<br><br>
</div></div>
Lara Michaels | 28 Jun 2012 21:27
Picon
Favicon
Gravatar

Re: is there a way to build xmonad-contrib 0.9.2 on a system with ghc 7.4.1?

Thank you for your help with this, too. Now I get another error in a different file where simply appending Eq b' doesn't do the trick:


[170 of 180] Compiling XMonad.Actions.GridSelect ( XMonad/Actions/GridSelect.hs, dist/build/XMonad/Actions/GridSelect.o )

XMonad/Actions/GridSelect.hs:227:12:
    Could not deduce (Eq b') arising from a use of `nub'
    from the context (Enum b', Num b')
      bound by the type signature for
                 diamondLayer :: (Enum b', Num b') => b' -> [(b', b')]
      at XMonad/Actions/GridSelect.hs:(226,1)-(229,35)
    Possible fix:
      add (Eq b') to the context of
        the type signature for
          diamondLayer :: (Enum b', Num b') => b' -> [(b', b')]
    In the expression: nub
    In the expression:
      nub
      $ ul
        ++
          (map (negate *** id) ul)
          ++ (map (negate *** negate) ul) ++ (map (id *** negate) ul)
    In the expression:
      let ul = [... | x <- ...]
      in
        nub
        $ ul
          ++
            (map (negate *** id) ul)
            ++ (map (negate *** negate) ul) ++ (map (id *** negate) ul)


Following your earlier advice, I have tried replacing the line

          diamondLayer :: (Enum b', Num b') => b' -> [(b', b')]

with both


          diamondLayer :: (Enum b', Num b', Eq b') => b' -> [(b', b')]

as well as

          diamondLayer :: (Enum b', (Num b', Eq b')) => b' -> [(b', b')]

but the compiler was unhappy about it in both occasions.

<div><div>
<div><span>Thank you for your help with this, too. Now I get another error in a different file where simply appending Eq b' doesn't do the trick:</span></div>
<div>
<br><span></span>
</div>
<div><span><br></span></div>
<div>[170 of 180] Compiling XMonad.Actions.GridSelect ( XMonad/Actions/GridSelect.hs, dist/build/XMonad/Actions/GridSelect.o )<br><br>XMonad/Actions/GridSelect.hs:227:12:<br>&nbsp;&nbsp;&nbsp; Could not deduce (Eq b') arising from a use of `nub'<br>&nbsp;&nbsp;&nbsp; from the context (Enum b', Num b')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bound by the type signature for<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b') =&gt; b' -&gt; [(b', b')]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at
 XMonad/Actions/GridSelect.hs:(226,1)-(229,35)<br>&nbsp;&nbsp;&nbsp; Possible fix:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add (Eq b') to the context of<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the type signature for<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b') =&gt; b' -&gt; [(b', b')]<br>&nbsp;&nbsp;&nbsp; In the expression: nub<br>&nbsp;&nbsp;&nbsp; In the expression:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; nub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ ul<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (map (negate *** id) ul)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++ (map (negate *** negate) ul) ++ (map (id *** negate) ul)<br>&nbsp;&nbsp;&nbsp; In the expression:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let ul = [... | x &lt;- ...]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 nub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $ ul<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (map (negate *** id) ul)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ++ (map (negate *** negate) ul) ++ (map (id *** negate) ul)<br><br><span></span>
</div>
<div><span><br></span></div>
<div>Following your earlier advice, I have tried replacing the line</div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b') =&gt; b' -&gt; [(b', b')]</div>
<div><br></div>
<div>with both</div>
<div><br></div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b', Eq b') =&gt; b' -&gt; [(b', b')]</div>
<div><br></div>
<div>as well as</div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', (Num b', Eq b')) =&gt; b'
 -&gt; [(b', b')]</div>
<div><br></div>
<div>but the compiler was unhappy about it in both occasions.<br>
</div>
<div><br></div>  </div></div>
Brandon Allbery | 28 Jun 2012 21:43
Picon
Gravatar

Re: is there a way to build xmonad-contrib 0.9.2 on a system with ghc 7.4.1?

On Thu, Jun 28, 2012 at 3:27 PM, Lara Michaels <laramichaels1978-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:
Following your earlier advice, I have tried replacing the line

          diamondLayer :: (Enum b', Num b') => b' -> [(b', b')]

with both

          diamondLayer :: (Enum b', Num b', Eq b') => b' -> [(b', b')]

This one is correct; you also need to add it to the definition of diamond on line 231, or the error will move there.  (I *think* that is sufficient, but it may be necessary to track down other places where the constraint must be added, as the compiler reports them.)

--
brandon s allbery                                      allbery.b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
wandering unix systems administrator (available)     (412) 475-9364 vm/sms

<div><div dir="ltr">On Thu, Jun 28, 2012 at 3:27 PM, Lara Michaels <span dir="ltr">&lt;<a href="mailto:laramichaels1978@..." target="_blank">laramichaels1978@...</a>&gt;</span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote">
<div><div>
<div>Following your earlier advice, I have tried replacing the line</div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b') =&gt; b' -&gt; [(b', b')]</div>
<div><br></div>
<div>with both</div>
<div><br></div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; diamondLayer :: (Enum b', Num b', Eq b') =&gt; b' -&gt; [(b', b')]</div>
</div></div>
</blockquote>
<div><br></div>
<div>This one is correct; you also need to add it to the definition of diamond on line 231, or the error will move there. &nbsp;(I *think* that is sufficient, but it may be necessary to track down other places where the constraint must be added, as the compiler reports them.)</div>
<div><br></div>
</div>-- <br>brandon s allbery &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="mailto:allbery.b@..." target="_blank">allbery.b@...</a><br>wandering unix systems administrator (available) &nbsp; &nbsp; (412) 475-9364 vm/sms<br><br>
</div></div>

Gmane