[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
And in fact in both cases, it appears that GHC is trying to derive the *wrong* instances of PolyVariadic. It should be deriving: PolyVariadic Int (WMonoid Int) not PolyVariadic Int (WMonoid m) and PolyVariadic [String] (WMonoid [String]) not PolyVariadic [String] (WMonoid String) specifica

Re: [Haskell-cafe] Re: Re-order type

2010-10-09 Thread Gene A
2010/10/9 André Batista Martins Said: > > Might have not been clear, but i will try illustrate . > > f:: a-> b -> c -> (b,(c,a)) > f1 :: c -> a -> d > - > > I think I would attack this with glue consisting of: comb f f1 a b c = arr (\(a,b,c) -> f a b c) >>> arr (\

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
Hi Brandon, True, when I replace [] with [""], I get a different error message: No instance for (PolyVariadic [[Char]] (WMonoid String)) which now looks a bit like the Int example. In both cases, GHC appears to be unable to derive the appropriate instance of PolyVariadic. Why this is so, but wo

Re: [Haskell-cafe] Layered maps

2010-10-09 Thread wren ng thornton
On 10/9/10 2:02 AM, Alex Rozenshteyn wrote: This came up as I was doing homework for natural language processing. I'm constructing a trigram model from training data, but I also need the bigram and unigram counts. I could, for each triple of characters, add the 3 tuple to a trigram map and incr

Re: [Haskell-cafe] Web development work

2010-10-09 Thread James Sanders
I was bored so I threw together this logo tonight . If you like it I could clean it up a bit. J. Sanders On 09/16/10 03:52, Michael Snoyman wrote: Hi all, Often times when trying to pitch Haskell to potential clients the concern is the lack of quali

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Jason Dagit
On Sat, Oct 9, 2010 at 8:52 PM, Brent Yorgey wrote: > On Sat, Oct 09, 2010 at 03:43:42PM -0700, Jason Dagit wrote: > > > > The Haskell.org server doesn't have to be upgraded. Maintainers can > install > > a newer darcs locally (cabal install darcs), do the upgrade locally and > then > > copy the

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Jason Dagit
On Sat, Oct 9, 2010 at 8:52 PM, Brent Yorgey wrote: > On Sat, Oct 09, 2010 at 03:43:42PM -0700, Jason Dagit wrote: > > > > The Haskell.org server doesn't have to be upgraded. Maintainers can > install > > a newer darcs locally (cabal install darcs), do the upgrade locally and > then > > copy the

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Brent Yorgey
On Sat, Oct 09, 2010 at 03:43:42PM -0700, Jason Dagit wrote: > > The Haskell.org server doesn't have to be upgraded. Maintainers can install > a newer darcs locally (cabal install darcs), do the upgrade locally and then > copy the repository back to the haskell.org server. Really? But then the

Re: [Haskell-cafe] Layered maps

2010-10-09 Thread Alex Rozenshteyn
Hmm. It seems that both the trie packages I found just provide a standard map-like interface, without exposing their trie-ness. Makes sense, but limits usefulness for me. Thanks. On Sat, Oct 9, 2010 at 3:08 PM, Jake McArthur wrote: > What you describe sounds like a perfect job for a trie, so t

Re: [Haskell-cafe] [Off-topic]Functional parsing theory

2010-10-09 Thread Maurício Antunes
After reading your message I found "Why Attribute Grammars Matter" and a few other introductions, and it seems attribute grammars are exactly what I'm trying to do. Do you know of some place (mailing list etc.) where I can discuss attribute grammars or ask for suggestions on design? Thanks, Maurí

Re: [Haskell-cafe] Re: Re-order type

2010-10-09 Thread Alexander Solla
On Oct 9, 2010, at 4:17 PM, André Batista Martins wrote: If i want compose f and f1, i need to do a correct input to f1 from the output of f. So i want one function to convert the output of "f" to input off "f!". In this case, we do f1 fst (snd (t,(t1,t2))) snd (snd (t, (t1,t2)))

[Haskell-cafe] Re: Re-order type

2010-10-09 Thread André Batista Martins
Might have not been clear, but i will try illustrate . f:: a-> b -> c -> (b,(c,a)) f1 :: c -> a -> d input type: A B C -- |f | | _ | output

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Jason Dagit
On Sat, Oct 9, 2010 at 3:06 PM, Brandon S Allbery KF8NH wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/9/10 08:30 , Christopher Done wrote: > > Every Darcs repository I've pulled this year has always showed me this > message: > > > > > *

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/9/10 08:30 , Christopher Done wrote: > Every Darcs repository I've pulled this year has always showed me this > message: > > *** > Fetching a hashed repository would be

Re: [Haskell-cafe] Re-order type

2010-10-09 Thread Edward Z. Yang
Excerpts from André Batista Martins's message of Sat Oct 09 17:45:05 -0400 2010: > Hello, > exists any algorithm to determine how terms can be changed to safisty the > type of one function? Your terminology is a little off: in particular, your example doesn't include any "terms" (which are under

Re: [Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/9/10 10:25 , Kevin Jardine wrote: > instance Show a => Monoidable a [String] where > toMonoid a = [show a] > > main = putStrLn $ unwrap $ polyToMonoid [] True () (Just (5::Int)) > > fails to compile. > > Why would that be? My understanding

[Haskell-cafe] Re-order type

2010-10-09 Thread André Batista Martins
Hello, exists any algorithm to determine how terms can be changed to safisty the type of one function? example: f:: a-> b -> c -> (b,c,a) f1 :: c -> a -> d In my first function "f" i want assign the output "c" and "a" for to input of function "f1". I searched for any solution, but i didn't

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocol implementation

2010-10-09 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/9/10 09:17 , Malcolm Wallace wrote: > > On 8 Oct 2010, at 16:56, Donn Cave wrote: > >> wikipedia: "Managed code is a differentiation coined by Microsoft to >>identify computer program code that requires and will only execute >>under th

Re: [Haskell-cafe] Layered maps

2010-10-09 Thread Jake McArthur
What you describe sounds like a perfect job for a trie, so that's what I think you should look into. - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocol implementation

2010-10-09 Thread Florian Weimer
* Donn Cave: > Quoth Florian Weimer , > >>> wikipedia: "Managed code is a differentiation coined by Microsoft to >>> identify computer program code that requires and will only execute >>> under the "management" of a Common Language Runtime virtual machine >>> (resulting in Bytecode)."

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
Another example that also fails to compile (but I cannot see why): import Data.PolyToMonoid import Data.Monoid instance Monoid Int where mappend = (+) mempty = 0 instance Monoidable Int Int where toMonoid = id main = putStrLn $ show $ unwrap $ polyToMonoid (0::Int) (1::Int) (2::Int)

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
Oleg, Another puzzle is that: instance Show a => Monoidable a String where toMonoid a = show a main = putStrLn $ unwrap $ polyToMonoid "" True () (Just (5::Int)) works just fine, but instance Show a => Monoidable a [String] where toMonoid a = [show a] main = putStrLn $ unwrap $ polyTo

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocol implementation

2010-10-09 Thread Malcolm Wallace
On 8 Oct 2010, at 16:56, Donn Cave wrote: wikipedia: "Managed code is a differentiation coined by Microsoft to identify computer program code that requires and will only execute under the "management" of a Common Language Runtime virtual machine (resulting in Bytecode)." In other wor

Re: [Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Roel van Dijk
The darcs installed on code.haskell.org is still version 2.02. It doesn't know about 'optimize --upgrade'. How do I upgrade those repositories? On Sat, Oct 9, 2010 at 2:30 PM, Christopher Done wrote: > Every Darcs repository I've pulled this year has always showed me this > message: > >

[Haskell-cafe] Make your Darcs repositories hashed?

2010-10-09 Thread Christopher Done
Every Darcs repository I've pulled this year has always showed me this message: *** Fetching a hashed repository would be faster. Perhaps you could persuade the maintainer to run darcs optimize --upgrade with darcs 2.4.0

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
Hi Bartek, Yes, it compiles, but when I try to use polyToMonoid', it turns out that this function is no longer polyvariadic, unlike the original polyToMonoid . This may be what Luke meant when he wrote "you lose composability". Even with the extra unwrap function I think that this is pretty cool

Re: [Haskell-cafe] Re: ANNOUNCE: tls, native TLS/SSL protocol implementation

2010-10-09 Thread Maciej Piechotka
On Sat, 2010-10-09 at 09:27 +0100, Vincent Hanquez wrote: > On Fri, Oct 08, 2010 at 12:59:56PM +0100, Maciej Piechotka wrote: > > 1. Could also callback in addition to handles be added? > > Like: > > > > connect' :: (ByteString -> IO ()) -> IO ByteString -> TLSClient IO () > > Would an interface

Re: [Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Bartek Ćwikłowski
Hello Kevin, 2010/10/9 Kevin Jardine : > I was attempting to turn this into a small library and wanted to avoid > exporting unwrap. > > I defined: > > polyToMonoid' = unwrap . polyToMonoid If you disable MonomorphismRestriction this definition typechecks just fine. Alternatively, you can ask ghci

[Haskell-cafe] Re: Polyvariadic functions operating with a monoid

2010-10-09 Thread Kevin Jardine
Hi Oleg, Thank you for this wonderful detailed solution! I was attempting to turn this into a small library and wanted to avoid exporting unwrap. I defined: polyToMonoid' = unwrap . polyToMonoid and then GHC told me: No instance for (PolyVariadic a (WMonoid m)) arising from a use of `p

Re: [Haskell-cafe] Desired behaviour of rounding etc.

2010-10-09 Thread Daniel Fischer
On Saturday 09 October 2010 06:34:32, Lennart Augustsson wrote: > That code is incorrect. You can't assume that the base for floating > point numbers is 2, that's something you have to check. > (POWER6 and z9 has hardware support for base 10 floating point.) > > -- Lennart Well, in light of --

[Haskell-cafe] Re: ANNOUNCE: Haskell XML Toolbox Version 9.0.0

2010-10-09 Thread Heinrich Apfelmus
Gregory Crosswhite wrote: Could you explain to me why HXT uses arrows? I have never been able to figure out what advantage this gives your library over monads. Since your arrows in practice implement ArrowApply, they are really just monads anyway, so it seems to me that using arrows instead

Re: [Haskell-cafe] Re: ANNOUNCE: tls, native TLS/SSL protocol implementation

2010-10-09 Thread Vincent Hanquez
On Fri, Oct 08, 2010 at 12:59:56PM +0100, Maciej Piechotka wrote: > 1. Could also callback in addition to handles be added? > Like: > > connect' :: (ByteString -> IO ()) -> IO ByteString -> TLSClient IO () Would an interface that generate the packet to send and just return them as bytes be even

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocolimplementation

2010-10-09 Thread Vincent Hanquez
On Fri, Oct 08, 2010 at 02:08:29PM +0200, Christopher Done wrote: > Indeed. Easier to install, easier to hack on (for Haskellers). Haskell > program coverage, debugging, extending your quickcheck tests, etc. absolutely. I'm certainly hoping to quickcheck all that is quickcheckable. The next thing

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocolimplementation

2010-10-09 Thread Vincent Hanquez
On Fri, Oct 08, 2010 at 12:54:48PM +0100, Sittampalam, Ganesh wrote: > What's the motivation for this? Well, I wanted to have a tls/ssl module that integrate nicely with haskell. until then the 2 solutions were: - shelling out to curl: that's not great, usually works until you have an error, and