[Nix-dev] Use Haskell for Shell Scripting

7c6f434c at mail.ru 7c6f434c at mail.ru
Tue Feb 10 08:00:24 CET 2015


>> If you hit an abstraction wall, maybe you would actually enjoy doing
>> what you originally wanted with access to lower-level abstraction.
>
>For xmonad StackSet is the lowest level.  Using something different
>amounts to writing a new window manager, a generalisation of xmonad.
>
>> Well, StumpWM allows arbitrary splits, very useful for Lazarus, Gimp,
>> etc.
>
>Oh, this is not about splits.  Xmonad allows that, too, via layouts.
>This is about the core data structure holding the current window
>configuration (the associations between windows and workspaces, and
>between workspaces and screens).  It is a core piece of the window
>manager and cannot be modified by an addon.  Haskell allows to abstract
>over this data structure easily, i.e. quantify over what is currently
>"StackSet".  The problem is: Xmonad does not do that.  There is no
>inherent technical difficulty in doing it, it just doesn't do it.
>
>The equivalent in C++ would be to use templates instead of concrete
>functions, but there is no good translation for type classes.  You
>really want type classes for this kind of thing.

I think you are thinking too big-system-design instead of
quick-scripting about that.

I have added an external module to StumpWM that goes completely against
the default logic of connecting screens, workspaces and windows.

It just moves windows between the workspaces when it needs to.

I still use the hard parts of a WM (X protocol handling) and just added
my own implementation of the fun parts.

>> Maybe you should try Ratpoison and give it commands from a Haskell
>> decision-making piece of code? Ratpoison also has arbitrary splits, it
>> is simpler than StumpWM and can do way less. Driving StumpWM
>> externally shoud also be easy, although with larger overhead.
>
>Generalising the xmonad source code would probably work better for me,
>because it allows me to stay in Haskell land and use types the way I'm
>used to.  Also I don't believe that a WM written in C can have what I'm
>looking for at all (abstracting over the core data structure).  It would
>have to be implemented by horrible pointer magic, and I don't want to
>touch that, even if it were there.

I think I was not clear with my idea about Ratpoison. I meant the Unix
way of doing things: there is Ratpoison that can easily receive commands
to change the splits and move the windows. Your logic is in Haskell and
it just sends commands to Ratpoison (which has been debugged once).





More information about the nix-dev mailing list