Hi folks,
I'm writing a Gnu DBM module as an exercise for learning Haskell and
its FFI. I'm wondering how I might write a function that returns the
database keys as a lazy list. I've wrapped the two relevant foreign
functions:
firstKey :: Ptr Db - IO (Maybe String)
nextKey :: Ptr Db -
On 10/25/07, Derek Elkins [EMAIL PROTECTED] wrote:
On Thu, 2007-10-25 at 11:30 -0400, Graham Fawcett wrote:
I'm writing a Gnu DBM module as an exercise for learning Haskell and
its FFI. I'm wondering how I might write a function that returns the
database keys as a lazy list. I've wrapped
On 10/25/07, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote:
On Oct 25, 2007, at 14:21 , Ryan Ingram wrote:
Right, but if you do something like
do
keys - getKeysLazy db
[.. some computation A here that may or may not evaluate all the
keys ..]
addRow db newRow
[.. some
On 10/25/07, Derek Elkins [EMAIL PROTECTED] wrote:
On Thu, 2007-10-25 at 11:30 -0400, Graham Fawcett wrote:
I'm writing a Gnu DBM module as an exercise for learning Haskell and
its FFI. I'm wondering how I might write a function that returns the
database keys as a lazy list.
Just use
On 10/26/07, Brent Yorgey [EMAIL PROTECTED] wrote:
In the end it looks to me like you're probably better off
just implementing traverse directly as you have done, although perhaps
someone will find a better way.
Beginner's luck. ;-) I see the unfold similarity, but yes, it doesn't
seem a good
On Nov 5, 2007 1:46 PM, Maurício [EMAIL PROTECTED] wrote:
Hi,
Is there a way to run 'ghc -e' taking input
from standard input? I would like to use it
in a pipe.
It seems to me that you can use getContents, et. al., as you would
from any other Haskell program:
$ echo hello there mauricio |
Hi folks,
Is there a way to declare a 'toString' function, such that
toString x | x is a String = x
toString x | x's type is an instance of Show = show x
Perhaps, in the type system, there's a way to declare a ToString
class, and somehow inherit all instances of Show as ToString
instances?
On Nov 6, 2007 10:30 AM, Bayley, Alistair
[EMAIL PROTECTED] wrote:
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Graham Fawcett
Is there a way to declare a 'toString' function, such that
toString x | x is a String = x
toString x | x's type is an instance of Show = show x
On Nov 6, 2007 12:03 PM, Thomas Schilling [EMAIL PROTECTED] wrote:
On Tue, 2007-11-06 at 09:18 -0500, Graham Fawcett wrote:
Hi folks,
Is there a way to declare a 'toString' function, such that
toString x | x is a String = x
toString x | x's type is an instance of Show = show x
I think
On Nov 6, 2007 2:21 PM, Jeff Polakow [EMAIL PROTECTED] wrote:
Have you tried using -fglasgow-exts? That should enable all ghc
extensions.
Ah thanks, that does it.
G
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Nov 6, 2007 3:29 PM, Graham Fawcett [EMAIL PROTECTED] wrote:
On Nov 6, 2007 2:21 PM, Jeff Polakow [EMAIL PROTECTED] wrote:
Have you tried using -fglasgow-exts? That should enable all ghc
extensions.
If anyone's interested, I had best results when I added the flag
-fallow-incoherent
On Nov 7, 2007 4:34 PM, Nicholas Messenger [EMAIL PROTECTED] wrote:
If you're willing to have an extra Typeable constraint, this does what you
want:
import Data.Typeable (Typeable, cast)
import Data.Maybe (fromMaybe)
toString :: (Show a, Typeable a) = a - String
toString x =
,
Graham
Graham Fawcett
Centre for Teaching and Learning
University of Windsor
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Nov 17, 2007 4:52 PM, Radosław Grzanka [EMAIL PROTECTED] wrote:
Also:
$ ./get http://digg.com/rss/indexvideos_animation.xml
However this one still seems to hang and eventually ends with :
get: recv: resource vanished (Connection reset by peer)
It's not a Haskell problem. It looks
On Nov 27, 2007 11:14 AM, Henning Thielemann
[EMAIL PROTECTED] wrote:
I think this is true, but for me it means, that we do not need another
advertisement at Haskell.org, but facts. I also expect that people
visiting the site already know about static typing and have categorized
themselves
On Jan 9, 2008 6:20 PM, Don Stewart [EMAIL PROTECTED] wrote:
anton:
Oh dear - I'm going to have to rethink the paper I was working on,
provisionally titled In defense of arbitrary untracked effects in high
assurance software. ;)
That would be an awesome paper :)
Hear, hear!
Anton, if
On Jan 14, 2008 2:47 AM, Sterling Clover [EMAIL PROTECTED] wrote:
HStringTemplate is a port of Terrence Parr's lovely StringTemplate
(http://www.stringtemplate.org) engine to Haskell.
This is very cool.
Your docs describe a function, cacheSTGroup:
cacheSTGroup :: Int - STGen a - STGen a
Given
Hi folks, I'm a newbie, so please forgive any terminological mistakes.
I've been using Shim in Emacs with great success, but there's one
issue I've encountered, and I don't know if it's configuration problem
or something fundamental. Consider a module 'App' and submodules
'App.Front' and
On Wed, Apr 16, 2008 at 5:30 PM, John Goerzen [EMAIL PROTECTED] wrote:
On Wed April 16 2008 3:54:45 pm Galchin, Vasili wrote:
hi Antoine,
I already found this link. Thanks in any case. I want to O_CREATE a
file, i.e. do a openFd creating a new file. O_CREATE should be the
I notice in the source for GHC.Handle that certain functions (e.g.
fdToHandle_stat) are in the export list, but are not actually exported
(at least, it seems you cannot import them). What mechanism causes
these functions to be hidden, and are they still accessible in some
way?
Graham
On Thu, Apr 17, 2008 at 4:26 AM, pepe [EMAIL PROTECTED] wrote:
On 16/04/2008, at 22:15, Graham Fawcett wrote:
I'd like to be able to tell Shim that 'App' is the root of my project,
and to locate modules from that root. Is this possible?
Shim already does this. All it requires
On Thu, Apr 17, 2008 at 10:38 AM, Bertram Felgenhauer
[EMAIL PROTECTED] wrote:
Graham Fawcett wrote:
I notice in the source for GHC.Handle that certain functions (e.g.
fdToHandle_stat) are in the export list, but are not actually exported
(at least, it seems you cannot import them
On Thu, Apr 17, 2008 at 10:41 AM, Marc Weber [EMAIL PROTECTED] wrote:
I'd like to be able to tell Shim that 'App' is the root of my project,
and to locate modules from that root. Is this possible?
If adding the cabal file does'nt work contact me and we'll try to
reslove this issue.
It
2008/4/17 Gour [EMAIL PROTECTED]:
Graham == Graham Fawcett [EMAIL PROTECTED] writes:
Graham Equally glad that it's being supported! Thank you.
Where one can found it?
Few days ago I was told on #haskell that shim is dead :-/
The original, I believe:
http://mapcar.org/haskell/shim
Hi folks,
Is there a common zipper implementation for the Tree a datatype, defined
in Data.Tree? The wiki gives examples for binary trees and B-trees, but not
for these.
Thanks,
Graham
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
On Wed, Apr 23, 2008 at 4:40 PM, Krasimir Angelov [EMAIL PROTECTED]
wrote:
Hi Graham,
There is one implementation here:
http://code.haskell.org/yi/Data/Tree/
I wrote it for Yi but it is quite general. It is a pity that we don't
have it in the standard libraries. It is not completely
Hi folks,
I'm studying zippers (and by extension, the State monad), and have
written a function for finding the first node-location in a 'zippered'
tree that satisfies a predicate:
http://paste.lisp.org/display/59636
(The code uses Krasimir Angelov's Data.Tree.Zipper.) My code works,
but I
Hi folks,
I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
response. So, something like:
sendCmd :: (Handle, Handle) - String - IO [String]
...
On Fri, May 2, 2008 at 12:16 AM, Donn Cave [EMAIL PROTECTED] wrote:
Graham Fawcett wrote:
I would like to communicate with an external, line-oriented process,
which takes a sequence of one-line commands, each returning an
arbitrary number of lines, and waits for another command after each
On Wed, May 14, 2008 at 1:38 AM, Janis Voigtlaender
[EMAIL PROTECTED] wrote:
Graham Fawcett wrote:
Yes, but that's still a 'quick' short-circuiting. In your example, if
'n' is Nothing, then the 'f = g = h' thunks will not be forced
(thanks to lazy evaluation), regardless of associativity
Hi folks,
I'm having trouble reasoning about laziness and FFI resources. I've
written a little C wrapper function to augment Text.XML.LibXML; given
a Ptr Node, it will return the node's tag-name:
foreign import ccall unsafe _getName :: Ptr Node - IO CString
Given LibXML's 'withNode' function,
On Sun, Jun 28, 2009 at 10:05 PM, Tony Morristonymor...@gmail.com wrote:
Is there a canonical function for traversing the spine of a list?
I could use e.g. (seq . length) but this feels dirty, so I have foldl'
(const . const $ ()) () which still doesn't feel right. What's the
typical means of
On Mon, Sep 22, 2008 at 1:12 PM, Bulat Ziganshin
[EMAIL PROTECTED] wrote:
Hello Simon,
Monday, September 22, 2008, 9:03:52 PM, you wrote:
With bytestrings, unboxed arrays, light-weight threads and other
tricks, we can usually replace all those ugly low-level programs with
nice high-level
On Wed, Sep 24, 2008 at 5:17 PM, Manlio Perillo
[EMAIL PROTECTED] wrote:
Hi.
I need a simple, concurrent safe, database, written in Haskell.
A database with the interface of Data.Map would be great, since what I need
to to is atomically increment some integer values, and I would like to avoid
On Thu, Sep 25, 2008 at 5:09 PM, Manlio Perillo
[EMAIL PROTECTED] wrote:
Graham Fawcett ha scritto:
If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
that will do atomic compare-and-set on a memory address, and I'm not
sure you could get much faster than that. :-)
I have
On Tue, Sep 30, 2008 at 9:18 AM, Manlio Perillo
[EMAIL PROTECTED] wrote:
Graham Fawcett ha scritto:
On Thu, Sep 25, 2008 at 5:09 PM, Manlio Perillo
[EMAIL PROTECTED] wrote:
Graham Fawcett ha scritto:
If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
that will do atomic
2008/9/30 wman [EMAIL PROTECTED]:
I got asked how to do one particular thing in excel, which led to discssion
with our local MSOffice expert.
During the discussion I stated that's it too much of a PITA and that I'd
rather write a script.
Long story short, I promised him a one-liner to show
2008/9/30 wman [EMAIL PROTECTED]:
Thanks a lot, I've had a hunch it was possible to get rid of those those
liftM's. I turned it into:
(writeFile output.csv) . printCSV . (map updateLine) . (either (error
Chyba pri cteni CSV.) id) = parseCSVFromFile input.csv
and am sincerely hoping he will
38 matches
Mail list logo