Let 'c2h' convert CStrings to Haskell Strings, and 'h2c' convert
Haskell Strings to CStrings. (If I understand correctly, c2h . h2c
=== id, but h2c . c2h is not the identity on all inputs;
That is correct. CStrings are 8-bits, and Haskell Strings are 32-bits.
Converting from Haskell to C
I have been reading Foreign.C.String but it does not seem to provide
the functionality I was looking for.
Let 'c2h' convert CStrings to Haskell Strings, and 'h2c' convert
Haskell Strings to CStrings. (If I understand correctly, c2h . h2c
=== id, but h2c . c2h is not the identity on all inputs;
Hello,
I wish to use a mutable array in multiple threads. Can IO arrays be
used in any thread, or only the thread they are created in? (So if I
create an IO array in one thread, pass it to another via an MVar, can
I read / edit it in that other thread?) Similarly about IORefs... can
they be
I tried a quick test with an IOArray, so I know that at least one time
it works. I don't know enough of the internals of IO and IOArray to
be able to extrapolate; there could be some race condition hidden
internally if IO is misused.
Thanks,
Eric
___
Because Data.Map is imported qualified, any symbols in it (including
Map) needs to be qualified:
type Bindings = Map.Map String Int
A standard idiom is to do import like so:
import qualified Data.Map as Map
import Map (Map)
so that the Map symbol itself does not need qualification.
Eric
Hi,
doc:
http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/Control-Concurrent-SampleVar.html
source:
http://www.haskell.org/ghc/docs/7.0-latest/html/libraries/base-4.3.0.0/src/Control-Concurrent-SampleVar.html
The documentation for Control.Concurrent.SampleVar implies
Hello,
The syntax highlighting file for literate haskell in vim says that its
maintainer is haskell-cafe@haskell.org, so hopefully one of you will
find this relevant.
In literate haskell files, vim optionally highlights the non-code text
according to TeX markup. The syntax highlighting file
So, are there any other simple motivating examples that show what
state is really good for?
Here's an example from some code that I'm (trying to) write; I am
writing a DSL for the Povray Scene Description Language. This part of
my program creates a `String' which holds a piece of Povray SDL
Since a tree is a kind of container, yes, it should be a monad. [I'm still
not really sure whether it's useful.]
I have a use for the tree monad -- well, I have a use for the monadic
`join' operation (but I don't use any of the monadic operations other
than `return').
My program is making a
I have another implementation of FreeModule which specializes S to the
natural numbers: but the set of functions f :: \mathbb{N} - R are
isomorphic with f :: [R] (provided we only permit infinite lists), in
the same way that Dave Menendez describes how f :: Bool - a is
isomorphic to f ::
So I've always wondered, if you are writing down a number being dictated
(slowly) by someone else, like 234, do you write the 2, then leave space and
write the 4, then go back and fill in with 3? Or do you push the 4 onto the
stack until the 3 arrives, and write 34 at once.
My German
I have been trying to write a DSL for Povray (see www.povray.org) in
Haskell, using the technique of:
http://okmij.org/ftp/papers/tagless-final-APLAS.pdf
with some inspiration taken from
http://okmij.org/ftp/Haskell/DSLSharing.hs
The Povray Scene Description Language is a very declarative
Try making a type class for the functions. That will allow you both varargs
and unions.
Have a look at Text.Printf.
Thank you -- looking at Printf was very helpful. My syntax is much
happier as a result.
I also see now that I am approaching the problem from the wrong
direction -- that by
IME nullable by default is one of the biggest
sources of runtime crashes in high level OOP languages like C#, which is a
shame because it really isn't that difficult to statically eliminate the
vast majority of them, especially when you're sort of hand-waving the
semantics of your language
14 matches
Mail list logo