Simon,
On Thu, 2013-10-03 at 08:07 +, Simon Peyton-Jones wrote:
> If you are using the lens library yourself, could you spare a few
minutes to tell me how you are using it?
I'm not a heavy 'lens'-user (yet), and this might not be the most pretty
use-case from a theoretic point of view, but an
I'd think
partition :: t -> Either t (t, t)
might be more suited then...
Nicolas
On Sep 29, 2013 1:21 AM, "Ryan Newton" wrote:
>
>
> On Sun, Sep 29, 2013 at 3:31 AM, Mike Izbicki wrote:
>
>> I've got a Partitionable class that I've been using for this purpose:
>>
>> https://github.com/mikeiz
I did use that a couple of times (`xor`ing 2 ByteStrings together), and was
surprised by the omission back then, but IIRC (can't validate now), there's
a specialised zipWith (as proposed) in the module (with some other name,
obviously), which is not exported, but used when you 'pack' the result of
On Sun, 2013-09-01 at 15:51 -0700, Wvv wrote:
> I think it is an old idea, but nevertheless.
> Now we have next functions:
>
> if (a :: Bool) then x else y
>
> case b of
> a1 :: Bool -> x1
> a2 :: Bool -> x2
> ...
>
> Let we have generic conditions for 'if' and 'case':
>
> class Boolean a where
# Redirected to haskell-cafe
On Sun, 2013-09-01 at 14:58 +0400, Artyom Kazak wrote:
> Would this be an appropriate place to propose adding mapM_ (and then
> possibly mapM) to bytestring library?
>
> Was it suggested before? If yes, why was it rejected?
This got me wondering: there are several
I didn't test it, but you might want to look into the 'rebindable syntax'
extension and its 'ifThenElse' feature.
Nicolas
On Sep 2, 2013 12:51 AM, "Wvv" wrote:
> I think it is an old idea, but nevertheless.
> Now we have next functions:
>
> if (a :: Bool) then x else y
>
> case b of
> a1 :: Bool
Hello Cafe,
I was playing around with TypeLits in combination with Typeable (using
GHC 7.7.7.20130812 FWIW), but was surprised to find Symbols aren't
Typeable, and as such the following doesn't work. Is this intentional,
or am I missing something?
Thanks,
Nicolas
{-# LANGUAGE DataKinds,
On Fri, 2013-08-23 at 08:06 +, o...@okmij.org wrote:
> > It will
> > arbitrarily pick the first match in the former and fail to compile
> in
> > the latter case.
> Of course we can have duplicate layers. In that case, the dynamically
> closest
> handler wins -- which sounds about right (think o
ate (F s) (MT s m)
-- Defined at tf2.hs:14:20
and
λ :t undefined :: F S
undefined :: F S :: T
-}
Nicolas
On Tue, 2013-05-21 at 00:08 +0200, Nicolas Trangez wrote:
> All,
>
> The following code results in a compilation error (I tried GHC 7.4.1 & a
>
Adam,
On Mon, 2013-05-20 at 13:37 +0100, Adam Gundry wrote:
> Hi Nicolas,
>
> Your design doesn't look too unreasonable, though I haven't looked at in
> detail. I do have a quick observation regarding the implementation that
> I hope might help. Your gist defines
>
> > class MonadLog m a where
>
omehow (some other things at
play there as well), but another suggestion on this list did.
Thanks for the help!
Nicolas
>
> 20.05.2013, 15:36, "Nicolas Trangez" :
> > All,
> >
> > Since I'm stuck on a coding problem and can't figure out how to proceed
All,
The following code results in a compilation error (I tried GHC 7.4.1 & a
7.7.20130430 build):
{-# LANGUAGE TypeFamilies,
GeneralizedNewtypeDeriving,
StandaloneDeriving #-}
module Main where
import Control.Applicative
import Control.Monad.RWS
data C = C
data E = E
All,
Since I'm stuck on a coding problem and can't figure out how to proceed,
I decided to call for help.
I'm unable to get some code to typecheck, so maybe I'm missing something
obvious on the implementation side, or more likely the design is
completely wrong.
Here's the idea: I have some code
On Fri, 2013-05-03 at 10:40 -0700, Hilco Wijbenga wrote:
> On 3 May 2013 09:44, Niklas Hambüchen wrote:
> > While I certainly enjoy the discussion, how about addressing one of the
> > original problems:
> >
> > On 02/05/13 13:27, Adrian May wrote:
> >> I just tried to use Flippi. It broke because
On Wed, 2013-03-27 at 21:30 +0200, Răzvan Rotaru wrote:
> I am terribly missing some syntactic sugar for maps (associative data
> structures) in Haskell. I find myself using them more than any other
> data
> structure, and I think there is no big deal in adding some sugar for
> this
> to the langua
On Tue, 2013-03-19 at 20:32 +, Don Stewart wrote:
> Oh, I forgot the technique of inlining the lazy bytestring chunks, and
> processing each chunk seperately.
>
> $ time ./fast
> 4166680
> ./fast 1.25s user 0.07s system 99% cpu 1.325 total
>
> Essentially inline Lazy.foldlChunks and speciali
On Wed, 2013-02-27 at 07:49 +0100, Vincent Hanquez wrote:
> On Mon, Feb 25, 2013 at 01:30:40PM +0100, Nicolas Trangez wrote:
...
> I've been looking at the same thing lately, and i've been quite surprised, to
> say the least, by the usual go-to packages (cereal, binary). Perform
On Mon, 2013-02-25 at 11:59 -0800, Johan Tibell wrote:
> On Mon, Feb 25, 2013 at 4:30 AM, Nicolas Trangez wrote:
>
> > - cereal supports chunk-based 'partial' parsing (runGetPartial). It
> > looks like support for this is introduced in recent versions of 'binar
On Thu, 2013-02-28 at 01:22 -0800, wren ng thornton wrote:
> On 2/27/13 2:17 AM, Vincent Hanquez wrote:
> > Two major problems of lazy bytestrings is that:
> >
> > * you can't pass it to a C bindings easily.
> > * doing IO with it without rewriting the chunks, can sometimes (depending
> >how th
All,
In order to implement some network protocol clients recently, I needed
binary serialization of commands and deserialization of responses
('Command -> ByteString' and 'ByteString -> Response' functions,
preferably for both strict as well as lazy ByteStrings).
My go-to packages have always bee
On Wed, 2013-02-13 at 08:39 -0800, David Thomas wrote:
> One way in which regexps are "foreign to Haskell-think" is that, if
> they
> break, they generally break at run-time. This could be ameliorated
> with
> template haskell
Care to elaborate on the "ameliorate using TH" part? I figure regexes
On Fri, 2012-12-21 at 04:36 -0900, Christopher Howard wrote:
> Using a simple type I gave earlier from my monadic type question...
>
> code:
>
> data Socket3 a b c = Socket3 a b c
> deriving (Show)
>
>
> Is it possible somehow to layer on record syntax onto a synonym of the ty
Note: IANAL
On Tue, 2012-12-11 at 17:45 -0800, David Thomas wrote:
> On Tue, Dec 11, 2012 at 5:35 PM, Brandon Allbery wrote:
>
> > (Oddly enough, GPL is not the only open source license.)
>
> There was no implication to the contrary. It was stated that BSD is a
> *weaker* license - this is true
Hi,
I published zeromq3-conduit, a small library which facilitates using
zeromq3-haskell, a binding for ZeroMQ 3.x, in a Conduit-based
application.
The 'examples' folder in the source repository contains ports of the
zeromq3-haskell examples.
The library also contains a module which might ease u
On Wed, 2012-11-28 at 09:17 +0200, Michael Snoyman wrote:
>
>
>
> On Tue, Nov 27, 2012 at 7:25 PM, Nicolas Trangez
> wrote:
> Michael,
>
> On Tue, 2012-11-27 at 17:14 +0200, Michael Snoyman wrote:
> > I think the stm-conduit pack
Michael,
On Tue, 2012-11-27 at 17:14 +0200, Michael Snoyman wrote:
> I think the stm-conduit package[1] may be helpful for this use case.
> Each time you get a new command, you can fork a thread and give it the
> TBMChan to write to, and you can use sourceTBMChan to get a source to
> send to the c
All,
I've written a library to implement servers for some protocol using
Conduit (I'll announce more details later).
The protocol supports pipelining, i.e. a client can send a 'command'
which contains some opaque 'handle' chosen by the client, the server
processes this command, then returns some
On Sat, 2012-11-17 at 16:27 +0100, Herbert Valerio Riedel wrote:
> what do you hope to gain from making your flags type an instance of
> the
> Enum class?
Among others, the ability to list all flags using "[Flag1 ..]"
How is this handled for libraries wrapping C libs which use some bitset
struct
On Sat, 2012-11-17 at 16:52 +0200, Roman Cheplyaka wrote:
> Hi Nicolas,
>
> The simplest approach would be to use the standard (derived) Enum
> instance that would be used for enumerations (like [Flag1..]), and
> have your own functions to convert to/from magic constants.
Sure, but that kind-of
All,
I've been working on a server implementation of an existing networking
protocol. The protocol uses "magic constants" in some places (e.g. to
tag message types), as well as bitfields, or a combination of both
packed in a single value.
I created data types for both the identifiers as well as t
On Fri, 2012-09-07 at 15:55 -0700, Johan Tibell wrote:
> On Fri, Sep 7, 2012 at 4:54 AM, Nicolas Trangez wrote:
> > On Thu, 2012-09-06 at 12:07 -0700, Johan Tibell wrote:
> >> Have a look at the popCount implementation for e.g. Int, which are
> >> written in C
On Thu, 2012-09-06 at 12:07 -0700, Johan Tibell wrote:
> Have a look at the popCount implementation for e.g. Int, which are
> written in C and called through the FFI:
>
> https://github.com/ghc/packages-ghc-prim/blob/master/cbits/popcnt.c
Out of interest: isn't this compiled into the popCnt# pri
All,
For some code I need to alter an (unboxed or storable) vector by
blit'ing (copying) data from another (smaller) vector into it,
overwriting the existing data. I couldn't find a function for this in
the vector API, so I hacked something up which cuts the jobs (see
below), but it feels really u
All,
While working on my vector-simd library, I noticed somehow memory I'm
using gets corrupted/overwritten. I reworked this into a test case, and
would love to get some help on how to fix this.
Previously I used some custom FFI calls to C to allocate aligned memory,
which yields correct results,
On Sun, 2012-07-08 at 10:27 +0200, Gábor Lehel wrote:
> On Sun, Jul 8, 2012 at 3:05 AM, Nicolas Trangez wrote:
> > I implemented the inductive alignment calculation over One and Twice
> > (good idea, and easy to do), but I don't get the thing about
> > superclasses
On Sun, 2012-07-08 at 20:49 +1000, Reiner Pope wrote:
> I've not been following this thread very closely, but it seems like
> what you're trying to do may be related to Geoffrey Mainland's work on
> SIMD support in GHC. See [1] for his "SIMD-enabled version of the
> vector library". He's also writt
On Sun, 2012-07-08 at 01:40 +0200, Gábor Lehel wrote:
> unsafeXorSSE42 :: (Storable a,
> > SV.AlignedToAtLeast SV.A16 o1, SV.Alignment o1,
> > SV.AlignedToAtLeast SV.A16 o2, SV.Alignment o2,
> > SV.AlignedToAtLeast SV.A16 o3, SV.Alignment o3) =>
> > SV.Vector o1 a -> SV.Vector o2 a
On Sat, 2012-07-07 at 21:13 +0200, Nicolas Trangez wrote:
> As you can see, the zipWith Data.Vector.SIMD implementation is slightly
> slower than the Data.Vector.Storable based one. I didn't perform much
> profiling yet, but I suspect allocation and ForeignPtr creation is to
> bla
On Sat, 2012-07-07 at 21:59 +0200, Gábor Lehel wrote:
> An alternative solution is to encode all of the alignments in unary,
> which is more general; if they're all going to be a power of two you
> can "store" just the logarithm:
>
> data One
> data Twice n -- not practical to call it Double :)
>
All,
After my message of yesterday [1] I got down to it and implemented
something along those lines. I created a playground repository
containing the code at [2]. Initial benchmark results at [3]. More about
the benchmark at the end of this email.
First some questions and requests for help:
- I
On Fri, 2012-07-06 at 13:43 -0700, Thomas DuBuisson wrote:
> On Fri, Jul 6, 2012 at 1:06 PM, Nicolas Trangez wrote:
> > -- This fails:
> > -- Ambiguous type variable `a0' in the constraint:
> > -- (Storable a0) arising from a use of `sizeOf'
>
>
Hello Cafe,
Recently I've been playing with the implementation of an algorithm, for
which we already have highly-optimized implementations available (in
plain C/C++ as well as OCaml with calls to C through FFI).
The algorithm works on buffers/arrays/vectors/whatever you want to call
it, which nee
On Tue, 2012-06-26 at 22:39 +0300, Michael Snoyman wrote:
> I've run into those kinds of problems in the past as well. In general,
> interleaving of data streams can be difficult with enumerator. That's
> the reason I added connect-and-resume to conduit. I use the technique
> in warp[1], which in f
On Tue, 2012-06-26 at 21:32 +0200, Christopher Done wrote:
> On 26 June 2012 21:22, Nicolas Trangez wrote:
> > Might sound easy (and actually it's pretty easy in most other languages
> > I know, including an OCaml implementation), yet I fail to figure out how
> > t
Hello Cafe,
Some time ago I tried to implement a network service using iteratee (or
enumerator, can't remember), but gave up in the end. More recently I
wanted to create something similar (a similar protocol), but failed
again.
So I'm looking for some example code or something similar (Google onl
On Thu, 2012-01-19 at 13:12 +, Alexander V Vershilov wrote:
> Hello.
>
> I'm interested if there exists some library like warp but only for tcp.
> Or maybe some web page with skeleton for such server or with some
> variants, eg. concurent/single-threaded. I know that each service can
> have it
On Tue, 2012-01-17 at 15:35 +0400, Eugene Kirpichov wrote:
> Hi,
>
> I'm fixing a build error in a package that depends on the RTS API, which
> changed in 7.4, using #if __GLASGOW_HASKELL__ >= 740.
>
> However, build log shows that __GLASGOW_HASKELL__ is still 704, not 740 as
> I'd expect.
>
> I
On Wed, 2011-12-21 at 18:34 +, Daniel Waterworth wrote:
> I made this simple state machine combinator library today. I think it
> works as a simple example of a good use for GADTs.
>
> https://gist.github.com/1507107
Any way to do something along the lines of
type StateChange a = SC a a
han
48 matches
Mail list logo