On Dec 19, 5:14 pm, Michael Snoyman wrote:
>
> Well, here's one way of doing it. You have lots of choices here; these are
> the decisions I made in implementing the code:
>
> * myFuncB no longer lives in the IO monad. I wasn't sure if you specifically
> wanted that, but now it can work with *any*
I have looked at the recently released Control.Failure library but I
admit, I couldn't understand it completely. So given the example
below, how would Control.Failure help me here?
Thanks,
nt
-- Theirs (other library code stubs)
data TheirError = TheirErrorCase deriving Show
data TheirData = Th
On Tue, 2009-05-26 at 18:09 -0400, wren ng thornton wrote:
> GADTs can easily cover record selectors that apply to all constructors,
> and selectors that apply to one constructor (or a set of constructors
> producing the same type). If the family of selector sets forms a nice
> tree hierarchy, y
On Tue, May 26, 2009 at 4:32 AM, wren ng thornton wrote:
> One alternative is to use Haskell's support for ad-hoc overloading. Define a
> typeclass for each selector (or group of selectors that must always occur
> together) which is polymorphic in the record type. [...]
> It's not pretty, but it g
Hi,
I would like to get some advice on how to best implement a protocol.
The protocol in question is "Bayeux":
http://svn.cometd.org/trunk/bayeux/bayeux.html. The details don't
matter here - it defines a couple of requests and responses in JSON
format, basically JSON objects with different propert
As a follow up to my previous JSON serialization post I came up with a
first draft of some simple record type serialization/deserialization.
What I would like to know is, whether this is the right approach or what
better ways there are to make a custom data type an instance of class
JSON. Any cha
Dear list members,
I try to use Text.JSON
(http://hackage.haskell.org/cgi-bin/hackage-scripts/package/json) to
serialize and deserialize record types. As I understand it, the data
types need to be instances of class JSON. However I have difficulties
to come up with a nice implementation of showJSO
On Sat, 2007-10-13 at 18:33 -0300, Isaac Dupree wrote:
> GHC StdGen's random and randomR are somewhat slow. I found that
> changing to a custom ((x*a + b) `mod` c) random-generator (instance of
> RandomGen) much sped things up (since nothing depended on the random
> numbers being good quality).
On Mon, 2007-10-15 at 10:48 -0400, David Roundy wrote:
> I have no idea if this example will help your actual code, but it
> illustrates that at least in this example, it's pretty easy to gain an
> order of magnitude in speed. (That "func" is a weird function, by the
> way.)
>
Thanks for your re
On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote:
> Now you need to start forcing things; given laziness, things tend to
> only get forced when in IO, which leads to time being accounted to
> the routine where the forcing happened. If random / randomR are
> invoked with larg
On Sat, 2007-10-13 at 14:37 -0700, Don Stewart wrote:
> I've seen similar results switching to the SIMD mersenne twister C
> implementation for randoms:
>
> http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
>
> If there's interest, I can package up the bindings for hackage.
On Sat, 2007-10-13 at 13:35 -0400, Brandon S. Allbery KF8NH wrote:
> For starters, look into "seq". Try applying it to any expression
> using a generated random number. This should force evaluation to
> occur somewhere other than when random is trying to figure out what
> StdGen value it's b
On Sat, 2007-10-13 at 12:42 -0400, Brandon S. Allbery KF8NH wrote:
> Your apparently simple StdGen argument is actually a sort of program
> state (represented by unevaluated thunks, not by a state monad; see
> below) which gets altered with every invocation of random. If
> nothing is forced
On Sat, 2007-10-13 at 09:56 -0400, Brandon S. Allbery KF8NH wrote:
> Now you need to start forcing things; given laziness, things tend to
> only get forced when in IO, which leads to time being accounted to
> the routine where the forcing happened. If random / randomR are
> invoked with larg
On Fri, 2007-10-12 at 20:25 -0700, Stefan O'Rear wrote:
> On Sat, Oct 13, 2007 at 12:09:57AM +0200, ntupel wrote:
> > setup :: (Ord a, IArray a2 a, IArray a1 e, Num a) => [e] -> [a] -> (a1 Int
> > e, a1 Int e, a2 Int a)
> > calcAlias :: (Ord e, Num e, IArray a
Dear all,
I have implemented a small module to generate random items with a given
probability distribution using the alias approach [1] and unfortunately
compared to similar implementations in C++ or Java it is about 10 times
slower. I have to confess that I am still in the early stages of writing
16 matches
Mail list logo