[Haskell-cafe] duplicate type signatures

2013-03-27 Thread Heinrich Hördegen
Dear all, why is this allowed (GHCi, version 7.4.1): main :: IO () main = do let a, a :: Int a = 5 print a but this not: main :: IO () main = do let a :: Int a :: Int a = 5 print a Is there a deeper sens or is it just a little bit inconsistent? Heinrich ___

[Haskell-cafe] Parallel Data.Vector.generate?

2013-03-27 Thread Myles C. Maxfield
Hello all. I'm using the Data.Vector.generate function with a complicated creation function to create a long vector. Is it possible to parallelize the creation of each element? Alternatively, if there was something like parMap for vectors, I suppose I could pass id to Data.Vector.generate and use

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Eric Rasmussen
I agree that fromList or pattern matching at the function or case level are readable. We probably don't need new sugar. For what it's worth, in scala you can use "->" to construct tuples, so you'll sometimes see maps created like this: Map(1 -> "one", 2 -> "two", 3 -> "foo") You can always do som

Re: [Haskell-cafe] Remove redundancy with Template Haskell

2013-03-27 Thread Daniel Trstenjak
Hi Corentin, On Wed, Mar 27, 2013 at 09:13:41PM +0100, Corentin Dupont wrote: > I have a function that looks like this: > call :: SomeFunction -> String -> SomeState > > The string is actually the representation of the function passed in > parameter. It is stored in the state for documentation.

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Eli Frey
> Sorry, I forgot to explain (probably because I'm too used to it). I am referring to a syntax for easy creation of maps. Something equivalent to lists: > > to build a list: [ 1, 2, 3] > to build a map; { 1, "one", 2, "two", 3, "three"} > > Without it I am always forced to use fromList. This looks

[Haskell-cafe] Remove redundancy with Template Haskell

2013-03-27 Thread Corentin Dupont
Hi Café, I have a function that looks like this: call :: SomeFunction -> String -> SomeState The string is actually the representation of the function passed in parameter. It is stored in the state for documentation. So a call looks like that: call (\a -> putStrLn a) "\a -> putStrLn a" There is

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Răzvan Rotaru
Sorry, I forgot to explain (probably because I'm too used to it). I am referring to a syntax for easy creation of maps. Something equivalent to lists: to build a list: [ 1, 2, 3] to build a map; { 1, "one", 2, "two", 3, "three"} Without it I am always forced to use fromList. Răzvan On 27 Marc

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Nicolas Trangez
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

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Tikhon Jelvis
I'm genuinely curious as to how you use maps. I've found I use them far less in Haskell than in any other language: I only use them in select circumstances. And most of those uses would not benefit from a mayo literal. I suspect that many of the uses of map literals are better replaced with someth

Re: [Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Ivan Lazar Miljenovic
On 28 March 2013 06:30, Răzvan Rotaru wrote: > Hi, > > 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 language. I

[Haskell-cafe] [extension]syntactic sugar for maps

2013-03-27 Thread Răzvan Rotaru
Hi, 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 language. I could not find out whether such an extension is beeing di

Re: [Haskell-cafe] Pattern matching with singletons

2013-03-27 Thread Paul Brauner
Very helpful, thanks! I may come back with more singleton/type families questions :) On Tue, Mar 26, 2013 at 6:41 PM, Richard Eisenberg wrote: > Hello Paul, > > > - Forwarded message from Paul Brauner - > > > > > - is a ~ ('CC ('Left 'CA)) a consequence of the definitions of SCC, > >

Re: [Haskell-cafe] my take at knucleotide

2013-03-27 Thread Branimir Maksimovic
I have posted this version.Mad home grown HashMap and replaced IOref with Ptr.This made program twice as fast as current entry. {-# Language BangPatterns #-} The Computer Language Benchmarks Game-- http://benchmarksgame.alioth.debian.org/ Contributed by Branimir Maksimovic--import Data.B

Re: [Haskell-cafe] Word8 literals in ByteString haddock?

2013-03-27 Thread Francesco Mazzoli
At Wed, 27 Mar 2013 00:50:21 +, Niklas Hambüchen wrote: > Hey, > > according to > http://hackage.haskell.org/packages/archive/bytestring/0.10.2.0/doc/html/Data-ByteString.html#v:split > I can write: > > split '\n' "a\nb\nd\ne" > > Can I really do that? I don't know of a way to make a '\n' li