Fix fromJust exception in Volume plugin #90

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

dmalikov commented Feb 3, 2013

Suppose there is no PCM alsa device.

Xmobar failed with error: Maybe.fromJust: Nothing exception running with following config:

Config { persistent = True
       , lowerOnStart = False
       , hideOnStart = False
       , font = "-*-terminus-medium-r-normal--12-*"
       , border = NoBorder
       , borderColor = "#1c1c1c"
       , bgColor = "#1c1c1c"
       , fgColor = "#8080A1"
       , position = Static { xpos = 120
                           , ypos = 1060
                           , width = 1800
                           , height = 20
                           }
       , commands = [ Run Volume "default" "PCM" [] 5, Run StdinReader ]
       , sepChar = "%"
       , alignSep = "}{"
       , template = " %StdinReader% }{ %default:PCM% "
       }
Owner

jaor commented Feb 3, 2013

I'm getting this compilation error in ghc 7.4.1:

src/Plugins/Monitors/Volume.hs:141:27:
    Ambiguous occurrence `catch'
    It could refer to either `Prelude.catch',
                             imported from `Prelude' at src/Plugins/Monitors/Volume.hs:15:8-30
                             (and originally defined in `System.IO.Error')
                          or `Sound.ALSA.Exception.catch',
                             imported from `Sound.ALSA.Exception' at src/Plugins/Monitors/Volume.hs:22:31-35
Owner

jaor commented Feb 3, 2013

pressed 'send' too soon, sorry... i can solve the problem with import Prelude hiding (catch): does that work also in ghc 7.6?

Owner

jaor commented Feb 3, 2013

@dmalikov, while we're at it, we might also take a look at http://code.google.com/p/xmobar/issues/detail?id=79, if you feel like it... (but i can do that if you don't, no problem)

Contributor

dmalikov commented Feb 3, 2013

Yep, in ghc-7.6 there is a warning

src/Plugins/Monitors/Volume.hs:17:1: Warning:
    Module `Prelude' does not export `catch'

So I returned it back.

Contributor

dmalikov commented Feb 3, 2013

I can't reproduce different values in xmobar and alsamixer. They are the same :[

Owner

jaor commented Feb 4, 2013

I can't reproduce different values in xmobar and alsamixer. They are
the same :[

That's interesting... never mind, then, i'll try to find out what's
going on here (i do get different values).

Owner

jaor commented Feb 4, 2013

OK, i've pushed your patch and solved the catch problem just by
importing ALSA.Exception as a qualified module (i've also removed a
couple remaining uses of the hiding (catch) clause elsewhere).

Please, let me know whether it compiles (and works) fine 7.6 if you can
try!

@jaor jaor closed this Feb 4, 2013

Contributor

dmalikov commented Feb 4, 2013

Compiles and works fine on 7.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment