Bindings to the full hdf5 were supposed to be in the example set for
bindings-DSL. It doesn't use pkg-config, though, and hdf5 developers
didn't like the idea of adding support. [...]
That seems strange to me - pkg-config is such a useful system, and
support for it is incredibly easy to
I worked out a small hdf5 binding using cabal and bindings-DSL and
sqlite3 as my example.
I just wanted to add that I also started an HDF5 binding recently
(using hsc2hs only). It does more than enough for me ATM, so I don't
develop it actively, but if you want to pursue this (and I think
Hi,
I'm trying, without success, to understand the difference
between existencial quantification and polymorphic
datatypes. Can you give me a hint, or an example where
one is valid and the other is not?
Thanks,
Maurício
___
Haskell-Cafe mailing list
4294967296 :: Integer
(...)
In the above you can see the polymorphism of the return type of
fromInteger, it returns a Int8 or a Int32.
You can see the polymorphism of the argument of show, it takes an Int8
or Int32 or Integer.
The latest ghc-6.10.1 also allows avoiding use of SomeNum, see
But how is this:
data SomeNum = forall a. SN a
different from:
data SomeNum = SN (forall a. a)
At a glance they look the same to me — but only the first is accepted by
ghc.
Following the link you pointed in the last
message, I found this at 8.8.4.1:
data T a = T1 (forall b. b - b - b) a
If
Hi,
I would like to take some time to study Haskell properly, so
that I could help others and pay my debt for the many times
I had to bother with my syntax questions. And, of course,
make better use of the language.
My first attempt was to read the syntax description in
Haskell 98 report, and
Hi,
I have this problem trying to define a function
inside a do expression. I tried this small code
to help me check. This works well:
---
import Data.Ratio ;
main = do {
printNumber - let {
print :: (Num n,Show n) = n - IO () ;
print n = do { putStrLn $ show n}
} in return
I have this problem trying to define a function
inside a do expression. I tried this small code
to help me check. This works well:
I guess you intended to call printNumber in the quoted snippet?
(...)
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ImpredicativeTypes #-}
After you pointed my dumb
Thanks, everything works now.
What should I read to better understand the difference
for the type system between using - and 'let'? That is
not intuitive for me.
About layout, I used to filter my code to better fit
everyone taste before posting to this list. The filter
stoped working due to
Hi,
Here:
http://www.haskell.org/onlinereport/modules.html
I read:
Modules may reference other modules via
explicit import declarations, each giving
the name of a module to be imported and
specifying its entities to be imported.
Modules may be mutually recursive.
However, I get
Mauricio No. Only sqlite3_exec with INSERT, SELECT stuff,
Mauricio and saving everything that needs structure in pseudo-xml
Mauricio strings. Not that efficient, but easy to change to blobs when
Mauricio everything is ready and tested.
I see...I'm thinking to maybe store only paths for bigger
Haskeline is designed to remove the readline dependency, because Windows
does not have readline. So rlwrap is useless there.
Ah, I hadn't considered Windows support--that makes sense. Thanks,
that answers my questions.
AHH
One nice thing would be to write something like rlwrap
that would
There's a 'stability' field on cabal description files. Maybe
it could appear after the name on the main listing. Or, all
packages marked as 'Stable' at that field could get a beautifull
color.
I agree completely. There is not nearly enough documentation on
packaging in haskell and too many
Mauricio I've been doing a lot of low level sqlite3 lately (it's going
Mauricio to be on a hackage package as soon as I finish my current
Mauricio work).
Have you done any work with BLOBs?
No. Only sqlite3_exec with INSERT, SELECT stuff,
and saving everything that needs structure in
pseudo
Aren't Doubles evil? Integer is a nice type, Haskell
filosofy compliant. Doubles are not CDoubles, IEEE, infinite
precision or anything long term meaninfull. (Warning:
non-expert opinion.)
I've found the pico second accuracy useful in working with 'rate
equivalent' real time systems. Systems
patients, I wanted to be sure not to save wrong
information. It wouldn't matter if the clock is
saying we are on XVII century, as long as 10 seconds
would never be 10.1.
What are the interval durations you need to measure?
Since they are from equipment, what is the spec?
I read from serial
Hi Bulat,
(...)
Thus my cry for help explicitly to Haskellers on Windows.
(...)
It's a pitty that Windows receives so little support, but I guess if
nobody has a Windows box to test with, there's not much you can do about
it.
I think it deserves consideration: what about a mailing
list
POSIX realtime extensions have been developed to be high reliable.
(...) However, they offer
no guarantees on interval measurements, and the correction algorithms
can cause the measurement of a time interval of an hour or so duration
to be off by +/- 1 sec, especially within the first few hours
benchpress also uses System.CPUTime -- is
that what you are looking for?
I'm writing a program that will read medical signs
from many patients. It's important to have a precise
measure of the time interval between some signs, and
that can't depend on adjustments of time. (Supose
my software is
Both wikipedia and hackage rdtsc packages have lot of
warnings regarding things I'm not able to control. It
seems it doesn't work with many platforms, be it older
or multi-core, hibernating computers.
yes, i mean this lib but forget its name :) thank you
Don't know if it might help but:
However options in d) do not offer, afaik, type-safety which is emblem of
Haskell language, so I wonder how much this could be the problem for
real-world usage?
I've been doing a lot of low level sqlite3 lately (it's going to
be on a hackage package as soon as I finish my current work). As
long
Linux has High-Resolution Timers (HRTs) that may be appropriate. See
the manpage for clock_gettime(), which defines these HRTs:
[...]
CLOCK_MONOTONIC, in particular, looks suitable. Using it could be a
matter of just a few quick likes in FFI.
I don't know if Windows has similar features.
Hi,
I'm writing a program where I need to know elapsed
times between some events, but I can't depende on
Data.Time since ntpd or user can change that while
my program is running.
Is there an alternative? Something like how much
time has passed since the program has started would
be great.
Is there an alternative? Something like how much
time has passed since the program has started would
be great.
Have a look at benchpress on hackage.
But benchpress uses Data.Time.Clock.getCurrentTime. I understand
that is dependent from configuration. It's okay to benchmark a
fast
Hi,
Is there some way I can check the endianness
of the machine my haskell code is running in?
Thanks,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
This would solve half my problem. Can I always trust that? I've
been told before that everytime a C function returns a struct it
is actually returning a pointer, but I wasn't able to find that
written in stone
That's because it isn't true.
In fact one of the classical ways for a C
Sorry, I'm not talking about how C implements passing structures to
functions. The Haskell FFI can only bind functions that pass structures
by pointer, not by value. So if you've got a C function that passes them
by value then you need to write a wrapper function in C and bind to
that.
This
Why can ghc read the program, but not the standard
library parser? Does ghc use something else?
Is it possible to use whatever ghc uses to build
a prettyprinter?
Language.Haskell is known to be incomplete. The haskell-src-exts
package on http://hackage.haskell.org will be more useful.
Hi,
When I do:
foreign import nameOfFunction nameOfFunction
:: IO MyType
I can get a function that return MyType only if
it's a pointer or some of the C* type family. Is
it possible to write a new MyType and make it
allowed as a return type from foreign functions?
Is changing the compiler the
foreign import nameOfFunction nameOfFunction
:: IO MyType
Is it possible to write a new MyType and make it allowed as
a return type from foreign functions? Is changing the
compiler the only way to do that?
Of course you're not really returning a MyType but a pointer
Hi,
I have a small problem with System.Random.randoms. I need a rather
large number of random numbers but the following program consumes a
huge amount of memory. I terminated it when it used up more than 2 Gb:
Interesting. Well, if you don't solve this problem,
I recently needed random
Hi,
I've just seen this from Distribution.ModuleName (ghc 6.10):
toFilePath $ ( simple A.B.C )
to which ghci answers: A.B.C.
Shouldn't it say A/B/C? The reason why I'm asking is that I've
just created a Setup.hs with 'defaultMainNoRead', and 'Setup
build' complains it can't find
(...) The reason why I'm asking is that I've just created a
Setup.hs with 'defaultMainNoRead', and 'Setup build' complains
it can't find A.B.C. When I copy (move doesn't work) C.hs from
src_dir/A/B to src_dir/A.B.C.hs, it doesn't complain,
although it fails to generate my
Hi,
I would like to sugest a new basic type in Haskell. What if we had
something like this (with any other quoting character):
«Je ne parle pas français. Meu nome é Maurício. ¿Hablas español?»
This would be of type Utf8. I think now it is not a bad idea,
since Haskell source code is
I would like to sugest a new basic type in Haskell. What if we had
something like this (with any other quoting character):
«Je ne parle pas français. (...) ¿Hablas español?»
This would be of type Utf8. I think now it is not a bad idea,
since Haskell source code is supposed to be
So this proposal is more than a UTF8 type, since it
encompasses a move away from text as lists. What interfaces
would we have to text in this proposal?
Normal users would import modules with specific interfaces, like
functions or instances.
One possible such module
Hi,
I'm learnng to use fastcgi and, reading the examples,
I see the main loop is like this:
main = runFastCGI my_work
However, isn't a fastcgi program supposed to choose
a port where to listen to calls? For instance, in this
C example:
xzdev.com/nginx_fastcgi.html
doesn't the line
I was able to get this working with lighttpd, and
I did had to choose a port, but only at lighttpd
configuration, not at the Haskell source.
Thanks,
Maurício
ChrisK a écrit :
I have only used this, all of these are from Haskell:
pamac-cek10:~ chrisk$ cat /etc/apache2/other/httpd-fastcgi.conf
Thanks! This is actually a really nice tutorial! Do you mind if I
try to find a place for it in the wiki?
Go right ahead (...)
For reference:
http://haskell.org/haskellwiki/FFI_cook_book
Best,
Maurício
___
Haskell-Cafe mailing list
(...) But the major advantage of hsc2hs is that if your C
struct changes or you use a different C compiler, the allignment
and size as well as the offsets used in peek and poke will still
be correct since the compiler will calculate it for you. (...)
And you wanted to write a
If you are using hsc2hs (if you are using Cabal this is easy; just
rename the file to *.hsc and Cabal will take care of the rest), then
there is a macro for making this easier and so you don't have to think
about it. (...)
Well, after reading FFI addendum, I'm using
my loyal text editor. Am I
I think Haskell is not nice to write general purpouse libraries
that could be easily and completly wrapped by other languages.
You can wrap gtk, sqlite3, gsl, opengl etc., but you can't write
python bindings for Data.Graph.
But, then, if you claim there's nothing else Haskell can't do,
what do
Where do I find the documentation for the FFI for GHC? I've read the
FFI report, the GHC user guide and scoured haskell.org but they all
gloss over what commands you actually need to give GHC and how to give
them. foreign import blah blah just gives me undefined references.
One well
Hi Mauricio. What you want actually already exists in QuickCheck as
the Gen monad.
newtype Gen a
= Gen (Int - StdGen - a)
instance Monad Gen where
return a= Gen (\n r - a)
Gen m = k =
Gen (\n r0 - let (r1,r2) = split r0
Gen m' = k (m n r1
Hi,
Is there some abstraction in current ghc library
that implements something like Reader, but where
the value of the environment is updated at every
step? I imagine something that instead of running
like this:
runReader ( do ... ) environment
I would run like:
runReader ( do ... )
Is there some abstraction in current ghc library
that implements something like Reader, but where
the value of the environment is updated at every
step?
do-it-yourself? you can start from reader definition and add what you
need. you just need to make initial state consisting from state
itself
Hi,
According to this page:
http://www.haskell.org/ghc/docs/latest/html/libraries/Cabal/Distribution-Simple.html
there's an available toplevel declaration named:
autoconfUserHooks
in Distribution.Simple. However:
ghci --version
The Glorious Glasgow Haskell Compilation System, version 6.8.2
Is there some abstraction in current ghc library that implements
something like Reader, but where the value of the environment is
updated at every step?
It doesn't quite make sense, because one step isn't well defined.
How many steps is return (f x) ? how about return x = \y -
that, according to Duncan instructions.
I can't share with those who don't know darcs, though, since
hidden files (like .emacs or .xmonad directory) do not show up
in the web page (code/~mauricio). So my next sugestion is
that listing of files starting with dots be allowed, if that
doesn't cause problems
Hi,
After a lot of thinking, I can't get what I
am doing wrong in this code:
(...)
data ( RandomGen g ) = RandomMonad g a = RandomMonad (g - a)
RandomGen g is considered the constraint for the application of
RandomMonad constructor, but GHC does not conclude that every value of
(RandomMonad
Hi,
I've reading Control.Monad.Reader source code and
arrived here:
class (Monad m) = MonadReader r m | m - r where
I can't understand that syntax. Since this is not a
'data' line, what is the '|' supposed mean?
Thanks,
Maurício
___
Haskell-Cafe
Hi,
I've reading Control.Monad.Reader source code and
arrived here:
class (Monad m) = MonadReader r m | m - r where
I can't understand that syntax. Since this is not a
'data' line, what is the '|' supposed mean?
It's called a functional dependency. This is not part of the
Haskell-98
It's called a functional dependency. This is not part of the
Haskell-98 language standard; check the GHC manual.
The documentation says There should be more documentation, but there
isn't (yet). Yell if you need it. :)
you probably don't found it. since 6.6 (or 6.8?) ghc includes great
Hi,
After a lot of thinking, I can't get what I
am doing wrong in this code:
--
data ( RandomGen g ) = RandomMonad g a = RandomMonad (g - a)
instance Monad (RandomMonad g) where
return = RandomMonad . const
RandomMonad f1 = f2 = RandomMonad f3 where
f3 a = f2f1 a (next a)
I would like to include a few source files
as 'executable' sections in a .cabal package
description. However, although I do want to
use main=mainDefault features, I do not want
those packages to be installed when I run
'Setup.hs install'.
Yes, just use this in the executable section:
At first, make sure you have Bjarne Stroustrup book
(very important: last edition). If there's anything good
in C++, it's there. Look also at his homepage:
http://www.research.att.com/~bs/homepage.html
I got the third edition and read it a couple of times... It's not that
I'm lacking knowledge
(...)
But I do want it to be built (so Setup will
check dependencies, allow me to './Setup clean'
etc.). However, I would like './Setup install'
to install just the main library.
Just in case my response to you (in a previous thread that you started)
wasn't clear, EMGM also
What kind of things do you prefer? Databases, science,
math, web?
At first, make sure you have Bjarne Stroustrup book
(very important: last edition). If there's anything good
in C++, it's there. Look also at his homepage:
http://www.research.att.com/~bs/homepage.html
Bjarne is the guy who
I'm writing a Cabal package, using main=defaultMain
in Setup.hs. It has a library, and I want to also
build a few executables so I can test the library.
How am I supposed to do that? (...)
You might consider looking at the EMGM cabal file in the source.
Hi,
Some functions in C changes data using pointers,
like this example:
void change_int (int *n)
{
*n ++;
}
What is the proper way to handle that? I
guess I should wrap it like this:
foreign ccall change_int change_int
:: Ptr CInt - IO ()
Can I use that on a CInt in Haskell code?
Like
You might consider looking at the EMGM cabal file in the source.
https://svn.cs.uu.nl:12443/viewvc/dgp-haskell/EMGM/
(...)
From the site:
Échec de la connexion sécurisée
svn.cs.uu.nl:12443 http://svn.cs.uu.nl:12443 utilise un
certificat de sécurité
Hi,
I'm wrapping a library where functions take
as parameters pointers to a few standard
structs (as, well, all C libraries). I
would like to ensure that only pointers of
correct structs are passed to those functions.
What is the Haskell way to do that? My
idea is to do something like this:
Hi,
I'm writing a Cabal package, using main=defaultMain
in Setup.hs. It has a library, and I want to also
build a few executables so I can test the library.
How am I supposed to do that? My attempt was to
create 'executable' sections for those tests. However,
I don't know how to include the main
Hi,
If I have a Haskell wrapper (with unsafe...)
over a function that's never going to return
different values and is always side-effect
free, but can change depending on compile time
options of its library; my program is running,
and then the version of my library is updated
by my distribution
Hi,
If I have a Haskell wrapper (with unsafe...)
over a function that's never going to return
different values and is always side-effect
free, but can change depending on compile time
options of its library; my program is running,
and then the version of my library is updated
by my distribution
Hi,
Wouldn't it be nice if we had something
like 'void' in Foreign.Marshal.Error in
standard monad functions, so that we could
use it instead of, for instance, mapM_
or sequence_?
Best,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
_Some_ newcommers flounder because they expect Haskell to be just
another VB / C++ / Java / whatever. (Do we really want to encourage
these people to be learning Haskell in the first place?) (...)
I hope so. One of my most important motivations to try
Haskell was that I thought it was
The new QuasiQuotes extension arriving with ghc 6.10 is very exciting,
and handling multi-line string literals is like stealing candy from
a baby. ;)
(...)
Cool!!!
How exactly QuasiQuote behave, and what
is available to handle them? (Or: can I
find information already on the web?)
Sugestion:
What is the difference between empty list [] and list with one unit
element [()]?
Or, yet:
():[()] --is legal
10:[()] --is not
One list can contain elements of a
single type. Since the type of () is
() (element constructors and types
are allowed to have the same name),
a list of type [()]
Hi,
I want to use a few libraries from hackage
and have already download and built them. Can
I install those libraries somewhere in my
home dir (I want to avoid installing as root)
so that ghc can find them?
If so, which options should I give to Setup.hs
(with main=defaultMain) so that the
Hi,
I want to use a few libraries from hackage
and have already download and built them. Can
I install those libraries somewhere in my
home dir (...)
$ cabal instsll xmonad
Does exactly that by default. No other flags are required.
(...)
Nice. Thanks for all tips. Reading them I understood
Looking for Posix Linux API, I found www.linux-usb.org. It
has a lot (I think all I need) to start in Linux. Does anyone
knows where can I find related information for Windows, so
I can start without writing something that would be difficult
to support there?
Best,
Maurício
Hello,
I am
Hi,
I'll need to use a lot of USB at work and, after
looking around, it seems there's no general USB
code done. 'libusb' and 'openusb' do not seem
ready enough so that wrapping them would be easier
than writing from scratch. (If you think I am
wrong until here and have time to write me your
Agree about the answer, not about the question. The
correct one would be is it possible to change haskell
syntax to support the international notation (...)
For some sense of possible, the answer is clearly yes.
However, it is perhaps misleading to call commas
THE international notation. (...)
No, it is not. Strings created by show are
always supposed to be readable by read, no
matter which system used 'show' and which
system is using 'read'.
Maurício
Rafael C. de Almeida a écrit :
Mauricio wrote:
Hi,
A small annoyance some users outside
english speaking countries usually
it
deserves the effort.
Best,
Maurício
Tilo Wiklund a écrit :
Wouldn't that make it hard to parse lists of floats?
On Tue, 2008-09-16 at 09:29 -0300, Mauricio wrote:
Hi,
A small annoyance some users outside
english speaking countries usually
experiment when learning programming
languages
I'm happy to
finaly use a language where I can
use words of my language to name
variables, so I wonder if we could
also make that step.
Really?
There is a bunch of languages (like Glagol) that use words of Russian
language as keywords; AFAIK there aren't any Russian programmer who uses
them.
Do you think 'read' (actually,
'readsPrec'?) could be made to also
read the international convention
(ie., read 1,5 would also work
besides read 1.5)? I'm happy to
finaly use a language where I can
use words of my language to name
variables, so I wonder if we could
also make that step.
That
As of today, show ((1,2)::(Float,Float))
would not produce that kind of output.
Dan Piponi a écrit :
Mauricio asked:
Do you think 'read' (actually,
'readsPrec'?) could be made to also
read the international convention
(ie., read 1,5 would also work
besides read 1.5)?
What would you hope
Do you think 'read' (actually,
'readsPrec'?) could be made to also
read the international convention
(ie., read 1,5 would also work
besides read 1.5)? I'm happy to
finaly use a language where I can
use words of my language to name
variables, so I wonder if we could
also make that step.
The
Do you think 'read' (actually,
'readsPrec'?) could be made to also
read the international convention
(ie., read 1,5 would also work
besides read 1.5)?
No, as read is really intended to be a language-level tool, not
something that you should expose to end users. For
I would like to write a Haskell pretty-printer,
using standard libraries for that. How can I
check if the original and the pretty-printed
versions are the same? For instance, is there
a file generated by GHC at the compilation
pipe that is always guaranteed to have the
same MD5 hash when it comes
Do you think 'read' (actually, 'readsPrec'?)
could be made to also read the international
convention (ie., read 1,5 would also work
besides read 1.5)?
(...)
IMAO, it's bloody well stupid to use commas for
either the decimal separator or the thousands
separator, as it has a well
Chaddaï Fouché a écrit :
2008/9/16 Mauricio [EMAIL PROTECTED]:
Hi,
I would like to write a Haskell pretty-printer,
using standard libraries for that. How can I
check if the original and the pretty-printed
versions are the same? For instance, is there
a file generated by GHC
Hi,
A small annoyance some users outside
english speaking countries usually
experiment when learning programming
languages is that real numbers use
a '.' instead of ','. Of course, that
is not such a problem except for the
inconsistence between computer and
free hand notation.
Do you think
Hi,
I would like to write a Haskell pretty-printer,
using standard libraries for that. How can I
check if the original and the pretty-printed
versions are the same? For instance, is there
a file generated by GHC at the compilation
pipe that is always guaranteed to have the
same MD5 hash when it
Exactly! Thanks.
Maurício
Paulo Tanimoto a écrit :
You mean like this?
import Data.List (foldl', nub)
Or am I misunderstanding your question?
Paulo
On Mon, Sep 15, 2008 at 2:26 PM, Mauricio [EMAIL PROTECTED] wrote:
Hi,
'import' allows one to say 'hiding' to
a list of names
Hi,
'import' allows one to say 'hiding' to
a list of names. Is it possible to do the
opposite, i.e., list the names I want to
import? Something like import Module showing x?
Thanks,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Hi,
I tested the expression below
and it doesn't work. Is there
some way to achieve that (i.e.,
turning an expression inside
parenthesis into an operator)?
2 `(flip (^^))` (3%4)
Thanks,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Rafael C. de Almeida a écrit :
Derek Elkins wrote:
On Mon, 2008-09-15 at 18:42 -0300, Mauricio wrote:
Hi,
I tested the expression below
and it doesn't work. Is there
some way to achieve that (i.e.,
turning an expression inside
parenthesis into an operator)?
2 `(flip (^^))` (3%4
Sorry about this. I hit a critical mass of darcs conflicts (I look
forward to giving git a try) around the same time I got really busy at
work. I've been meaning to get back into it (and update it to GHC HEAD)
but I haven't received sufficient nagging yet. Please yell if you're
interested in
At this time It's not really a question
of better implementation, but cooperation.
I know Haskell, they know Java, and it
would be nice if we could share code and
work. The idea of the api, or maybe dbus,
seems OK. It just would be easier if we
could join everything in a single piece,
but it is
(...)
* Since a data constructor can be an infix operator (either spelled with
backticks or a symbolic name beginning with ':' ) we can also write our
patterns with infix notation.
(...)
(Slightly off-topic?)
Do you have any reference for that use of infixing
constructors by start their
Do you have any reference for that use of infixing
constructors by start their name with ':'?
(...)
(...) for data constructors, go to
http://haskell.org/onlinereport/lexemes.html
and search for `Operator symbols'. (...)
Here it is:
“Operator symbols are formed from one or more
There used to be.
http://www.cs.rit.edu/~bja8464/lambdavm/
(Last darcs change log entry:
Sun Oct 21 03:05:20 CEST 2007 Brian Alliet [EMAIL PROTECTED]
* fix build for hsjava change
)
Sorry about this. I hit a critical mass of darcs conflicts (I look
forward to giving git a try) around the
Hi,
Is it possible to use foreign function
interface with STMs? If so, where can I
find examples?
Thanks,
Maurício
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
abs (Pt {pointx = x, pointy = y}) = sqrt (x*x + y+y)
Why is it pointx=x and not x=pointx?
Your intuition is probably telling you that this
is something like:
abs (point) = sqrt (x*x+y*y)
where {x=pointx point ; y=pointy point}
Actually, it's an example of pattern matching:
abs
97 matches
Mail list logo