[Haskell-cafe] [ANN] xmobar 0.17 released

2013-05-04 Thread Jose A. Ortega Ruiz

I've just released version 0.17 of xmobar, a lightweight system monitor
written in Haskell.

Homepage:  http://xmobar.org
Release notes: http://xmobar.org/releases.html

_New features_

  - Icons support: it's now possible to insert bitmaps in the template
(Edward O'Callaghan, Alexander Polakov and Tomáš Janoušek).
  - Initial support for reacting to mouse clicks (Alexander Polakov).
  - New `TopP` and `BottomP` alignments, taking left and right
paddings (thanks to Dmitry Malikov).
  - New `freeratio` field for memory monitor (Peter Simons).
  - New `allDesktops` and `overrideRedirect` configuration options,
providing dock behaviour in tiling WMs (when set to True and False
respectively). Cf. discussion at [github #105].
  - Experimental `-d` (start as a dock) option, may address [github #67]
in some window managers.

_Bug fixes_

  - Partial (as reports go) fix for [github #77].
  - Safer volume plugin (Dmitry Malikov).
  - Battery percentage capped at 100% (RJ Regenold).

Enjoy!
-- 
I always pass on good advice. It's the only thing to do with it. It is
never any use to oneself.
 -Oscar Wilde

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [ANN] xmobar 0.16 released

2012-12-02 Thread Jose A. Ortega Ruiz

I've just released xmobar 0.16, the lightweight text-based system
monitor written in Haskell.  See http://projects.haskell.org/xmobar, and
full release notes below.

As always, thanks a bunch to the many contributors, who keep helping me
improving xmobar and making it more and more useful.  The continuous
flow of patches and suggestions is one the nicest things about hacking
on and maitaining xmobar.

This is a somewhat risky release, because some users are reporting
problems with GHC 7.6.1 and xmonad (see links below), but there are so
many new features and fixes, and happy users of the unstable version,
that i thought a release was in order.  Please, do not hesitate to
complain about problems you might encounter: i'll do my best to fix them
in subsequent releases.

Thanks!

## Version 0.16 (Dec 3, 2012)

_New features_

  - New monitor `AutoMPD`, which uses asynchronous events to display
MPD status (thanks to Ben Boeckel).
  - New monitor `BufferedPipeReader` displaying data from multiple
pipes (thanks to Jochen Keil).
  - New monitor `DynNetwork`, which detects the active interface
automatically, by Reto Hablützel
  - New monitor, `Locks`, displaying the status of lock keys, by
Patrick Chilton.
  - Extension for DBUS signal handling (Jochen Keil)
  - Hide/Reveal: one can send signals to xmobar and make it (un)hide
itself (Jochen again).
  - `PipeReader`'s default text is now configurable, by Reto Hablützel.
  - Dependencies updated to latest mtl and libmpd (thanks to Sergei
Trofimovich).
  - Dependencies on the deprecated dbus-core removed in favour of
dbus 0.10 (thanks to Jochen Keil).
  - MPris2 now includes genre and composer among its fields.

_Bug fixes_

  - `DiskIO` now can report overall activity in all partitions of a device
which is not mounted itself (e.g., sda when sda1, sda3, etc. are
the mounted partitions).  Thanks to John Soros. See [github #73].
  - `DiskU`, the disk usage monitor, works again correctly on Linux,
instead of randomly crashing every now and then, and reporting
wrong used size.
  - When using antialiased fonts, we were causing a memory leak in the
X server by repeatedly allocating colors that, apparently, the
server doesn't know how to get rid of (even when told so!).  We're
caching them now and X server memory doesn't grow.
  - Compilation errors and warnings with GHC 7.6 removed (thanks to
Raghavendra D Prabhu for his reports in [github #71]).

_Known problems_

Some users have reported problems with xmobar compiled with GHC 7.6 in
ArchLinux: see [github #78] and pointers therein.  Please, send
reports of any problems or successes in that regard so that we can fix
any remaining issues.  Thanks!

[github #71]: https://github.com/jaor/xmobar/issues/71
[github #73]: https://github.com/jaor/xmobar/issues/73
[github #78]: https://github.com/jaor/xmobar/issues/78

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNOUNCEMENT] xmobar 0.14

2011-12-11 Thread Jose A. Ortega Ruiz
On Sun, Dec 11 2011, Roman Cheplyaka wrote:

 * Jose A. Ortega Ruiz j...@gnu.org [2011-12-11 08:43:01+0100]
 On Sun, Dec 11 2011, Brandon Allbery wrote:
 
 [...]
 
  xmobar currently requires parsec 3.x; the above is the symptom of
  building it against 2.x.
 
 Aha, thanks for pointing this out, guys.
 
 Peter, would using parsec 3.x be an acceptable solution to you?

 To avoid problems like this, please specify version constraints in the
 .cabal file. See [1] for the details.

Thanks for your suggestion.  Yes, that's what i was thinking of doing;
but i wanted to know before that if there might be reasons for people
not being able or not wanting to use parsec 3 (in which case i might try
to rewrite the parsing code using parsec 2-compatible calls, assuming
there's a compatibility layer in parsec 3).


Cheers,
jao
-- 
One reason that life is complex is that it has a real part and an
imaginary part.
 -Andrew Koenig

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNOUNCEMENT] xmobar 0.14

2011-12-11 Thread Jose A. Ortega Ruiz
On Sun, Dec 11 2011, Roman Cheplyaka wrote:

[...]

 To avoid problems like this, please specify version constraints in the
 .cabal file. See [1] for the details.

I'm actually preparing a new release with stricter version constraints
(the new .cabal is
https://github.com/jaor/xmobar/blob/master/xmobar.cabal, in case anyone
has the time to check whether i'm doing something dumb).  

It's clear to me what contraints to use for packages not included in
ghc, but there're some of them that come with the compiler (unix, time
and filepath in my case): what's the best practice regarding those
packages?  I've left they're version unspecified, intending to mean
whatever version comes with your ghc.

Is that a good practice?

TIA,
jao
-- 
Ignorance more frequently begets confidence than does knowledge
  - Charles Darwin


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [ANNOUNCEMENT] xmobar 0.14

2011-12-10 Thread Jose A. Ortega Ruiz

I'm happy to announce the release of xmobar 0.14.

Xmobar is a text-based, minimalistic status bar for linuxy systems,
written in Haskell.  See http://projects.haskell.org/xmobar for
details.

Many, many thanks to the many, many contributors, and apologies for
taking so long to put their code and fixes under a new release.

In this episode:

_New features_

  - New brightness monitor, courtesy of Martin Perner.
  - New DateZone plugin, for configurable timezone and localized
datetimes, also by Martin.
  - New keyboard layout monitor (Kbd).  Yes, by Martin.
  - Rewrite of the event handling ([issue 53], [issue 57]), you
guessed it.
  - Cpu monitor now also reports `iowait` field ([issue 55]).
  - Battery monitor: the full charge file is now settable in the
monitor arguments (olpc systems use `charge_full_design`; see
[issue 62]).

_Bug fixes_

  - [issue 45]: Fix for crashes with AC status changes in battery monitor.
  - [issue 48]: The quality field of Wireless behaves like a percentage.
  - [issue 50]/[issue 61]: `MPD` monitor now works with libmpd 0.6.
  - [issue 60]: Fixes for crashes on power resume for battery monitor.
  - Template sections without fields are now correctly displayed.
  - Catch errors when reading battery status (Ben Boeckel).
  - Compilation issues with ghc 7.x (Sergei Trofimovich).
  - Fixes for CoreTemp monitor in new kernels (Norbert Zeh).
  - Fix for pulseaudio problems in volume monitor (Martin Perner).
  - Fix for parsing errors when a `Run` entry ended in an array
(Martin).
  - Fixed compilation in OpenBSD (Ivo van der Sangen).

[issue 45]: http://code.google.com/p/xmobar/issues/detail?id=45
[issue 48]: http://code.google.com/p/xmobar/issues/detail?id=48
[issue 50]: http://code.google.com/p/xmobar/issues/detail?id=50
[issue 53]: http://code.google.com/p/xmobar/issues/detail?id=53
[issue 55]: http://code.google.com/p/xmobar/issues/detail?id=55
[issue 57]: http://code.google.com/p/xmobar/issues/detail?id=57
[issue 60]: http://code.google.com/p/xmobar/issues/detail?id=60
[issue 61]: http://code.google.com/p/xmobar/issues/detail?id=61
[issue 62]: http://code.google.com/p/xmobar/issues/detail?id=62

Cheers,
jao


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNOUNCEMENT] xmobar 0.14

2011-12-10 Thread Jose A. Ortega Ruiz
On Sun, Dec 11 2011, Brandon Allbery wrote:

[...]

 xmobar currently requires parsec 3.x; the above is the symptom of
 building it against 2.x.

Aha, thanks for pointing this out, guys.

Peter, would using parsec 3.x be an acceptable solution to you?

Cheers,
jao
-- 
Life isn't about finding yourself. Life is about creating yourself.
   -George Bernard Shaw, writer, Nobel laureate (1856-1950)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCEMENT: xmobar 0.13

2011-03-27 Thread Jose A. Ortega Ruiz

I'm happy to announce the release of xmobar 0.13.

xmobar is a lightweight, text-based system monitor for un*x systems.
See http://projects.haskell.org/xmobar/ for the whole story.


## Version 0.13 (March 28, 2011)

_New features_

  - New `Volume` monitor displaying ALSA soundcards information, by
Thomas Tuegel.
  - New `ThermalZone` plugin substituting `Thermal` and using linux's
*sysfs* interface (you need this one if you're using a kernel
version equal to or above 2.6.37). See [issue 44].
  - xmobar app new has WM_CLASS, WM_NAME and _NET_WM_PID xprops
([issue 38]).

_Incompatible changes_

  - In the process of solving [issue 14], we've broken those
configurations that rely on including alignment separators in the
input fed to `StdinReader`.
  - The MPD plugin does not accept host and port options anymore: use
the environment variables MPD_HOST and MPD_PORT instead.
  - The `Mail` plugin now takes a second parameter (a string)
specifying its alias. As a side-effect, this solves [issue 30].

_Bug fixes_

  - [issue 14]: `StdinReader` and other plugins accepting external
input don't get confused anymore when characters from `alignSep`
appear in their input.
  - [issue 27]: `BottomSize` placement now respects its width argument.
  - [issue 28]: Compilation in Mac OS X fixed.
  - [issue 30]: `Mail` plugin can be specified anywhere in commands list.
  - [issue 36]: Battery monitor now supports non-standard locations of
the `/sys/class/power_supply/AC/online` file.
  - [issue 40]: Battery monitor now supports the new power_now, that
replaces current_now in linux kernels for v. 2.36 and above.
  - [issue 42]: More accurate net monitor rates.
  - DiskIO, Cpu and MultiCpu monitors are also more accurate now.
  - Text is now correctly centered vertically.
  - `FullBM` border spec fixed.


Happy monitoring,
jao
-- 
Computer games don't affect kids; I mean if Pac Man affected us
as kids, we would all be running around in darkened rooms, munching
magic pills, and listening to repetitive electronic music.
 - Kristian Wilson, Nintendo Inc.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: xmobar 0.12 released

2010-12-23 Thread Jose A. Ortega Ruiz

I'm happy to announce a new relase of xmobar, the text-based monitor
bar. You can read everything about xmobar and this release at our new
web address (http://projects.haskell.org/xmobar/), or see below for a
summary of what's new (cf.
http://projects.haskell.org/xmobar/releases.html).

## Version 0.12
  
xmobar has a new [maintainer], a new [website], a new [mailing
list] and uses a new [source code repository].

Many thanks to Andrea Rossato, xombar's author and maintainer so far,
for creating xmobar in the first place, and for giving me the chance
to become its maintainer. And a big thanks to Ben Boeckel, Petr Rockai
and Norbert Zeh for their patches.

[website]: http://projects.haskell.org/xmobar/
[mailing list]: http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar
[source code repository]: https://github.com/jaor/xmobar
[maintainer]: http://hacks-galore.org/jao/

_New features_

  - Window borders: configuration options `border` and `borderColor`
allow drawing borders around xmobar's window.
  - New monitor, `Uptime`, showing the system uptime.
  - New monitor argument (`-S`) to enable displaying the `%` symbol in
percentages or other suffixes (e.g., units in Uptime and Network);
the symbol is now never included by default.
  - New 'run once' commands, by specifying a 0 refresh rate in `Run
Com` ([issue 26]).
  - MPD monitor: updated to libmpd 1.5. New fields `ppos` (playlist
position) and `remaining` (remaining time). New configuration
options to specify MPD's host, user name and password.
  - Battery monitor: new `watts` and `timeleft` fields (Petr Rockai),
and specific arguments to control coloring and thresholds of the
former.
  - MultiCPU monitor: new `auto*` fields that automatically detect all
present CPUs (Ben Boeckel).
  - CpuFreq monitor uses just one decimal digit for GHz values (Petr
Rockai).
  - Mail plugin expands paths starting with ~/ (Ben Boeckel). Ditto
MBox.
  - Weather monitor now skips not retrieved fields, instead of
displaying a long error message.
  - New compilation flag, `all_extensions`.
  - Documentation and website updates.

_Bug fixes_

  - [issue 23]: Wireless monitor is now compatible with iwlib 29.
  - [issue 24]: Swap monitor's used ratio display fixed.
  - [issue 25]: Percentages only include `%` if requested using `-P`.
  - [issue 31]: MPD monitor now respects `-W` argument.
  - Fixes in CPU frequency formatting, string alignment and colour
boxes in monitors (Norbert Zeh).
  - TopMem and TopProc now use the `-L` and `-H` options correctly for
memory template fields.
  - MBox skips non-existent mbox paths instead of hanging.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] New Xmobar maintainer: request for comments

2010-12-05 Thread Jose A. Ortega Ruiz

Hi,

I've recently accepted Andrea Rossato's kind offer to take over
maintainership of xmobar, and i wanted to ask for feedback to the
community. My apologies for cross-posting to the cafe and xmonad, but
xmobar didn't have a mailing list until a couple days ago.

My immediate plans are to fix some low-hanging bugs, incorporate a
handful of patches and contributions i have in my repo and make a new
release (0.12). Besides that, i've created a mailing list
(xmo...@projects.haskell.org,
http://projects.haskell.org/cgi-bin/mailman/listinfo/xmobar, also
mirrored at gmane.comp.lang.haskell.xmobar) and i will move xmobar's
homepage to http://projects.haskell.org/xmobar (not done yet).

Perhaps more disruptingly, i'm thinking of moving source code management
from darcs to git (right now, i maintain a _mirror_ at github,
http://github.com/jaor/xmobar). But xmobar has a very lively user base
and many contributors, and i wouldn't like to alienate or disturb
anyone: would that move be frown upon by the community?

I also plan to keep hacking and adding (not many) features to xmobar in
the future, and would be delighted to hear from you: please, do not
hesitate to send your feature requests or any other comment directly to
me or to the new list.

Thanks in advance for your feedback, and special thanks to Andrea for
creating xmobar and giving me this great chance of being more than a
mere spectator of the haskell world.

Cheers,
jao
-- 
Fools ignore complexity. Pragmatists suffer it. Some can avoid it.
Geniuses remove it.
  - Alan Perlis, Epigrams in Programing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Functional dependencies and Peano numbers

2010-07-10 Thread Jose A. Ortega Ruiz
On Sat, Jul 10 2010, wren ng thornton wrote:


[...]


 Yes, you can add multiple dependencies. The syntax is to use , after
 the first |.

 While having eight parameters is surely a desperate need for
 refactoring, there are times when you'd want multiple dependencies.
 For example, you can say

 class F a b | a - b, b - a where...

 to express a bijective function on types (that is, for every pair of A
 and B, if you know one of them then you know what the other must be
 uniquely).

I know i should read the relevant articles, but how would one express
such a bijection using type families?

TIA,
jao
-- 
You err by thinking simplicity and elegance are mostly
cosmetic.  Simplicity and elegance are overwhelmingly
practical virtues.
  - William D Clinger, comp.lang.scheme

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Run haskell program in emacs without typing main in the ghci buffer.

2010-04-26 Thread Jose A. Ortega Ruiz
Zura_ x...@gol.ge writes:

 Hello,

 Is it possible to run haskell program in emacs without typing main in the
 ghci buffer? Assuming main function exists of course.
 Or, maybe automate sending main\n string to ghci buffer input.
 In other words, I want edit/run/see result style session.

Assuming you're using haskell-mode, does

  M-x inferior-haskell-load-and-run

do what you want? You can of course define a shortcut for it:

  (define-key haskell-mode-map \C-l 'inferior-haskell-load-and-run)

If you don't want to load the file, just run main:
  
   (defun haskell-main ()
  (interactive)
  (inferior-haskell-send-command (inferior-haskell-process)
 :main))

(This a very simple version; there're many possible variations; for
instance, adding (swith-to-haskell) at the end).

HTH,
jao

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: darcsum.el 1.2 released

2010-04-09 Thread Jose A. Ortega Ruiz
Simon Michael si...@joyful.com writes:

 Unfortunately it will still hang if darcs emits something it can't
 parse. An emacs process-filter is used to drive an interactive darcs
 command, like an expect script. The process-filter can receive darcs
 output in random chunks, so it's hard to distinguish a parse failure
 from partial output, unless the output has a recognisable prefix,
 which some of it does not (eg darcs amend's.) I'm not sure what a more
 robust way to drive darcs looks like.

Maybe i'm not understanding the problem, but cannot you just accumulate
the output in an auxiliary variable and parse the ouput as a whole once
the darcs process finishes?

Thanks a lot for working on darcsum, btw!

jao
-- 
There are two ways to write error-free programs; only the third one
works.
  - Alan Perlis, Epigrams in Programing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Using Cabal during development

2010-02-09 Thread Jose A. Ortega Ruiz
Johan Tibell johan.tib...@gmail.com writes:

 It's really unfortunate that this approach doesn't work for .hsc
 files. When writing low level libraries I often have a couple of these
 which forces me out of my nice Emacs workflow into an Emacs + terminal
 + Cabal workflow.

I use the elisp code below to run cabal without leaving emacs, with its
output going into a compilation buffer (so that one can jump to the
errors). C-c c will find the cabal file nearest to the current buffer
and invoke cabal.

HTH,
jao

--8---cut here---start-8---

(defun jao-locate-dominating-files (regexp optional file)
 Look up the directory hierarchy from FILE for a file matching REGEXP.
 Stop at the first parent where a matching file is found and return the
 list
 of files that that match in this directory.
 (catch 'found
   (let ((dir (file-name-as-directory (or file (buffer-file-name
 files)
 (while (and dir
 (not (string-match locate-dominating-stop-dir-regexp
dir)))
   (if (setq files (condition-case nil
   (directory-files dir 'full regexp 'nosort)
 (error nil)))
   (throw 'found files)
 (if (equal dir
(setq dir (file-name-directory
   (directory-file-name dir
 (setq dir nil
 nil)))

(defun jao-haskell-locate-cabal-file ()
 Find the cabal file associated with current buffer.
 (car (jao-locate-dominating-files .+\\.cabal)))

(eval-after-load 'haskell-mode
 '(add-hook 'haskell-mode-hook
(lambda ()
  (set (make-local-variable 'compile-command) cabal
 build

(defun jao-haskell-cabal-build ()
 Run, in a compilation buffer, a cabal command, after finding
the cabal file associated with this buffer.
 (interactive)
 (let ((cabal-file (jao-haskell-locate-cabal-file)))
   (unless cabal-file
 (error Couldn't find associated cabal file))
   (let ((default-directory (file-name-directory cabal-file)))
 (call-interactively 'compile

(eval-after-load 'haskell-mode
  '(define-key haskell-mode-map [?\C-c ?c] 'jao-haskell-cabal-build))

--8---cut here---end---8---

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] cannot post to haskellmode-em...@projects.haskell.org

2010-02-06 Thread Jose A. Ortega Ruiz

Hi,

all my posts to the haskellmode-emacs list (using the address in the
subject) are being rejected with the error:

  451 451 Temporary local problem - please try later (state 18)

(after several retries by the Google smtp server, which i use as a
smarthost).

Any idea of what could be causing this problem?

Thanks!
jao
-- 
There are two ways to write error-free programs; only the third one
works.
  - Alan Perlis, Epigrams in Programing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: question about hsc2hs

2010-02-03 Thread Jose A. Ortega Ruiz
Ross Paterson r...@soi.city.ac.uk writes:

 If you compile your C program with -D_FILE_OFFSET_BITS=64 you'll get the
 same numbers that hsc2hs does.

Aha, that was the key to solve my problem: programs or libraries
compiled with that flag must use statfs64() instead of statfs(). Binding
to the former in my .hsc produces correct results.

Thanks for the hint, Ross.

Cheers,
jao

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


question about hsc2hs

2010-02-02 Thread Jose A. Ortega Ruiz

Hi. I'm copying below a question i sent to another list about hsc2hs
(and for which i got no response), in the hopes that it will be not be
OT here. My apologies if it is!

I'm trying to write a simple C binding for statfs(2). Simplifying,
writing an hsc file that contains the following snippet:

  #include sys/vfs.h

  data CStatfs
  foreign import ccall unsafe sys/vfs.h statfs
c_statfs :: CString - Ptr CStatfs - IO CInt

  getFileSystemStats :: String - IO CLong
  getFileSystemStats path =
allocaBytes (#size struct statfs) $ \vfs -
useAsCString (pack path) $ \cpath - do
  res - c_statfs cpath vfs
  case res of
-1 - return 0
_  - do
  bsize - (#peek struct statfs, f_bsize) vfs
  bcount - (#peek struct statfs, f_blocks) vfs
  bfree - (#peek struct statfs, f_bfree) vfs
  bavail - (#peek struct statfs, f_bavail) vfs
  -- Just for demonstration: the original code creates a data structure
  return $ bsize + bcount + bavail + bfree

gives rise, when using hsc2hs, to this translation:

  getFileSystemStats path =
allocaBytes ((84)) $ \vfs -
useAsCString (pack path) $ \cpath - do
  res - c_statfs cpath vfs
  case res of
-1 - return 0
_  - do
  bsize - ((\hsc_ptr - peekByteOff hsc_ptr 4)) vfs
  bcount - ((\hsc_ptr - peekByteOff hsc_ptr 8)) vfs
  bfree - ((\hsc_ptr - peekByteOff hsc_ptr 16)) vfs
  bavail - ((\hsc_ptr - peekByteOff hsc_ptr 24)) vfs
  return $ bsize + bcount + bavail + bfree

(where i have deleted LINE directives). The problem is that the size and
some of the offsets of the C struct statfs computed by hsc2c are wrong:
i'm in a 32bit linux system, and i've checked, using a C program, that
sizeof(struct statfs) is 64 (hsc2 is giving 84 -- although perhaps
Haskell needs additional space for housekeeping?), and that the offsets
of f_bfree and f_bavail are, respectively, 12 and 16 (not 16 and 24).
Also, i know that 12 and 16 are the right values because putting them by
hand gives me the correct statfs values.

(This is ghc 6.10.4 on a debian/sid system)

What am i doing wrong?

TIA!
jao
-- 
It is hard enough to remember my opinions, without also remembering my
reasons for them.
   -Friedrich Wilhelm Nietzsche, philosopher (1844-1900)

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: question about hsc2hs

2010-02-02 Thread Jose A. Ortega Ruiz
Ross Paterson r...@soi.city.ac.uk writes:

 On Tue, Feb 02, 2010 at 03:51:18PM +0100, Jose A. Ortega Ruiz wrote:
 [...] The problem is that the size and
 some of the offsets of the C struct statfs computed by hsc2c are wrong:
 i'm in a 32bit linux system, and i've checked, using a C program, that
 sizeof(struct statfs) is 64 (hsc2 is giving 84 -- although perhaps
 Haskell needs additional space for housekeeping?), and that the offsets
 of f_bfree and f_bavail are, respectively, 12 and 16 (not 16 and 24).
 Also, i know that 12 and 16 are the right values because putting them by
 hand gives me the correct statfs values.

 If you compile your C program with -D_FILE_OFFSET_BITS=64 you'll get the
 same numbers that hsc2hs does.

But when i use those offsets (16, 24) in my Haskell program (generated
by hsc2hs), i get the wrong values when i inspect the struct filled by
statfs() (via the call performed by Haskell's FFI), while if i put (by
hand this time) the ones (12, 16) given by the C program without
_FILE_OFFSET_BITS defined, the results are correct. So it looks like the
C library, or the generated code, is not using that value for
_FILE_OFFSET_BITS. Do i need to compile my Haskell code using a similar
flag?

(Sorry if i'm missing something obvious.)

Thanks!
jao

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: haskell-mode.el mailing list (+ dpatch)

2009-11-25 Thread Jose A. Ortega Ruiz
Svein Ove Aas svein@aas.no writes:

 Well, I know when I'm beat..

 http://trac.haskell.org/haskellmode-emacs/

 http://projects.haskell.org/cgi-bin/mailman/listinfo/haskellmode-emacs

Excellent! Thanks. Any objection to my adding the list to gmane.org?

Cheers,
jao
-- 
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: haskell-mode.el mailing list (+ dpatch)

2009-11-25 Thread Jose A. Ortega Ruiz
Svein Ove Aas svein@aas.no writes:

 I certainly don't mind.

 I've noticed that the list administrative interface has a news-gateway
 option. Is there anything I should do there?

I've submitted the request. I don't think the news-gateway option is
needed in this case, but i'll ask when i hear back from gmane.

Thanks!
jao
-- 
I don't necessarily agree with everything I say.
 -Marshall McLuhan (1911-1980)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: haskell-mode.el mailing list (+ dpatch)

2009-11-24 Thread Jose A. Ortega Ruiz
valery...@gmail.com (Valery V. Vorotyntsev) writes:

 Is there anybody except me feeling the need for mailing list and issue
 tracker for emacs' haskell-mode?

FWIW, you have my vote too. I'm convinced that a discussion forum and
tracker would foster contributions from the many emacs users in the
community.

Cheers,
jao
-- 
Purely applicative languages are poorly applicable.
  - Alan Perlis, Epigrams in Programing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: htzaar-0.0.1

2009-10-09 Thread Jose A. Ortega Ruiz

Hi,

When i try to cabal install htzaar i get the following error:

src/Main.hs:11:7:
Could not find module `Play':
  Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
htzaar-0.0.1 failed during the building phase. The exception was:
exit: ExitFailure 1

Any idea about what's going on?

Thanks!
jao
-- 
Editing is a rewording activity.
  - Alan Perlis, Epigrams in Programing

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: htzaar-0.0.1

2009-10-09 Thread Jose A. Ortega Ruiz
Tom Hawkins tomahawk...@gmail.com writes:

 Sorry, I forgot to add the other modules to the cabal file.  Try
 htzaar-0.0.2.

Thank you, it's working now.

jao
-- 
The reasonable man adapts himself to the world; the unreasonable
one persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man. - George Bernard Shaw

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Examples of using Haskell for mathematics

2008-05-28 Thread Jose A. Ortega Ruiz
Brent Yorgey [EMAIL PROTECTED] writes:

 Hi all!

 In a couple weeks I will be giving a short (15-min.) talk to an
 audience of mostly mathematicians, entitled Executable Mathematics: A
 Whirlwind Introduction to Haskell. The idea will be to give a flavor
 of Haskell, its uniquenesses, and why it is a great language for
 playing around with mathematics, by way of some well-chosen examples.
 There are definitely plenty of such examples out there, and I've
 already found quite a few that I might use, but I thought I would send
 an email to the cafe to ask whether anyone has any code which you
 think particularly exemplifies some aspect of why Haskell is a great
 language for mathematics. I'm looking to include a wide range of
 examples, so any length (from a few to hundreds of lines of code) and
 any level (from simple number theory to things only a few people in
 the world understand) are fair game.


I've enjoyed immensely several entries in Dan Piponi's 'A Neighborhood of
Infinity'. In particular, 'Infinitesimal rotations and Lie algebras':

http://sigfpe.blogspot.com/2008/04/infinitesimal-rotations-and-lie.html

made me decide once and for all that i want to grok Haskell.

HTH,
jao
-- 
Go to Heaven for the climate, Hell for the company. - Mark Twain

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


haskell newbie seeking for advice

2003-08-14 Thread Jose A . Ortega Ruiz

hi all,

as stated in the subject, i'm a newcomer to haskell programming: i've
read some tutorials and (portions of) a couple of books and am really
fascinated with the language. but my haskell coding experience is
limited to toy programs and short exercises. so i decided to try my
hand at a small project to really learn haskell and the functional
programming mindset[1], and i would appreciate to hear your opinions
and comments on some issues before i start coding:

- build toolchain. i'm used to the autoconfig/automake/make tools for
  C/C++ projects, and to ant for Java stuff. what do haskellers use?
  my initial thought was using a plain Makefile with ghc, but there is
  also hmake and maybe other tools i am missing. what would you use? [2]

- graphics toolkit. one of my programs will be a GUI. there seems to
  be a lot of choice here: gtk2hs looks nice (as used in hircules) and
  fudgets seems to have a pretty interesting and well-documented
  architecture (which covers also client/server programming: i'll be
  using a client/server architecture too) but its widgets are uglier
  and look alien in current linux desktops. i'd like to have a
  fudgets-gtk framework of sorts :) and then, there is htoolkit,
  Object I/O and whatnot... any recommendations?

- TCP/IP stuff. i will have a client/server architecture with TCP/IP
  as the transport protocol. other than fudgets, i'm not aware of any
  haskell framework for IPC: am i missing something?

- XML. i'll be handling XML documents, and HaXml seems to me an
  excellent candidate to cover this area, but, of course, i'm very
  interested in hearing of alternatives...
  
thanks a lot for your help!

cheers,
jao

Footnotes: 
[1]  if that matters, the project will consist on a set of utilities
for handling a document metadata database, based upon the OMF standard.

[2] my project will consist of several executables, sharing a set of
common libraries and, therefore, i plan to use (if possible) a
non-flat directory layout.

-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare. - Blair Houghton.
___
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe