[Haskell-cafe] haddock changes between 2.10 and 2.12?

2012-09-24 Thread Edward Kmett
Was there some significant change/bug introduced to haddock made between
2.10 and 2.12?

When I look at the haddocks for kan-extensions 3.1:
Data.Functor.Yonedahttp://hackage.haskell.org/packages/archive/kan-extensions/3.1/doc/html/Data-Functor-Yoneda.html
which
purports to have been built by haddock 2.12 it shows all sorts of spurious
superclass constraints on almost every instance that should have simplified
out, but going back to kan-extensions-2.7:
Data.Functor.Yonedahttp://hackage.haskell.org/packages/archive/kan-extensions/2.7/doc/html/Data-Functor-Yoneda.html
none of this extra noise is present -- and the code in question hasn't been
changed in the interim, so I'm pretty sure its not on my end.

-Edward
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partial statical linking

2012-09-24 Thread Jason Dusek
2012/9/19 Brandon Allbery allber...@gmail.com:
 On Wed, Sep 19, 2012 at 7:06 AM, Jason Dusek jason.du...@gmail.com wrote:
 What I attempted was building a binary with only some C libraries
 statically linked, with this command line:

   # Build https://github.com/erudify/sssp on Ubunut 12.04
   ghc -outputdir ./tmp -v --make -O2 sssp.hs -o sssp.ubuntu \
 /usr/lib/x86_64-linux-gnu/libffi.a \
 /usr/lib/x86_64-linux-gnu/libgmp.a \
 /usr/lib/x86_64-linux-gnu/libz.a

 However, this really made no difference. Running `ldd' on the
 resulting binary reveals that libz and friends are still
 dynamically linked:

 On Linux you probably need -optl--whole-archive for this to do anything;
 alternately, you would need to get the final ld command line out of ghc and
 insert the above libraries into it *after* the package .a files.

 Putting them before the packages (including the GHC runtime) that need them,
 as will happen by default, will cause them to be ignored because they
 contain no required symbols *at that point* in the link.  --whole-archive
 tells to blindly link the whole static archive in instead of ignoring it.

Hi Brandon,

This turned out to be the right ticket. The full command line is
like this:

  ghc -outputdir ./tmp --make -O2 sssp.hs -o sssp.ubuntu \
-optl-Wl,--whole-archive \
  /usr/lib/x86_64-linux-gnu/libffi.a \
  /usr/lib/x86_64-linux-gnu/libgmp.a \
  /usr/lib/x86_64-linux-gnu/libz.a \
-optl-Wl,--no-whole-archive

Without the --no-whole-archive at the end, I get errors like:

  (.text+0x880): multiple definition of `__morestack_unblock_signals'
  /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a(generic-morestack.o):(.text+0x880):
first defined here
  /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc.a(generic-morestack.o): In
function `__morestack_allocate_stack_space':

I am not sure why that happens -- libgcc.a wasn't explicitly
asked for; but it stands to reason that one shouldn't specify
--whole-archive for everything GHC links, just the archives of
interest. Life is short and art is long.

--
Jason Dusek
pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Darcs on Windows 7

2012-09-24 Thread Magnus Therning
On Sun, Sep 23, 2012 at 12:36 AM, Erik de Castro Lopo
mle...@mega-nerd.com wrote:
 Vasili I. Galchin wrote:

 Hello Haskellers,

   I installed darcs on a Windows 7 machine. A darcs folder was created
 under Program Files(x86) folder. However, when I pull up Program... on
 the left side, darcs not there for me to run it. Why? Is darcs run only
 from the CLI?

 Yes, darcs is a command line program.

There is a GUI for windows, but I have no idea whether it's good or
not: http://tortoisedarcs.sourceforge.net/

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Darcs on Windows 7

2012-09-24 Thread Alp Mestanogullari
I have tested it a long time ago. It worked fine.
However, when I need to use darcs on Windows 7 now, I just use the CLI, I
don't really need more.

On Mon, Sep 24, 2012 at 3:07 PM, Magnus Therning mag...@therning.orgwrote:

 On Sun, Sep 23, 2012 at 12:36 AM, Erik de Castro Lopo
 mle...@mega-nerd.com wrote:
  Vasili I. Galchin wrote:
 
  Hello Haskellers,
 
I installed darcs on a Windows 7 machine. A darcs folder was
 created
  under Program Files(x86) folder. However, when I pull up Program...
 on
  the left side, darcs not there for me to run it. Why? Is darcs run only
  from the CLI?
 
  Yes, darcs is a command line program.

 There is a GUI for windows, but I have no idea whether it's good or
 not: http://tortoisedarcs.sourceforge.net/

 /M

 --
 Magnus Therning  OpenPGP: 0xAB4DFBA4
 email: mag...@therning.org   jabber: mag...@therning.org
 twitter: magthe   http://therning.org/magnus

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Alp Mestanogullari
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Michael Snoyman
On Mon, Sep 24, 2012 at 2:53 PM, George Giorgidze giorgi...@gmail.com wrote:
 Hi Michael,

 Here at the University of Tübingen, I am co-supervising (together with
 Jeroen Weijers) a student project implementing the OverloadedLists
 extension for GHC. Achim Krause is the student who is working on the
 project. We took into consideration earlier discussions on this topic
 [1,2] before embarking on the project.

 Achim has worked on two approaches.

 The first approach is very simple, both from the user's and the
 extension implementor's perspective (it follows the implementation of
 OverloadedStrings closely) and typechecks and desugars lists like

 [] ; [x,y,z] ;  ['a' .. 'z'] ;

 as

 fromList [] ;  fromList [x,y,z] ; fromList ['a' .. 'z'] ;

 where fromList is whatever is in scope with that name. That said, we
 do provide the FromList type class that can be used to overload
 fromList. In the following I give the definition of the class, as well
 as, example instances:

 class FromList l where
   type Item l
   fromList :: [Item l] - l

 instance FromList [a] where
   type Item [a] = a
   fromList = id

 instance (Ord a) = FromList (Set a) where
   type Item (Set a) = a
   fromList = Set.fromList

 instance (Ord k) = FromList (Map k v) where
   type Item (Map k v) = (k,v)
   fromList = Map.fromList

 instance FromList (IntMap v) where
   type Item (IntMap v) = (Int,v)
   fromList = IntMap.fromList

 instance FromList Text where
   type Item Text = Char
   fromList = Text.pack

 This approach has already been implemented by Achim as patch against GHC head.

 This approach is very simple, but can be inefficient as it may result
 into unnecessary construction of lists at runtime. This can be a
 serious issue when constructing large structures from arithmetic
 sequences (e.g., from the [ .. ] notation) or when using non-literal
 expressions (e.g., variables) inside the square brackets.

 Our second approach to OverloadedLists is to avoid the construction of
 lists altogether. By typechecking and desugaring lists like

 [] ; [x,y,z] ;  ['a' .. 'z'] ;

 as

 mempty ; singleton x `mappend` singleton y `mappend` singleton z ;
 genericEnumFromTo 'a' 'z' ;

 We  provide the Singleton and GenericEnum type classes for overloading
 singleton and genericEnum(..) functions. In the following, I give the
 definitions of the classes, as well as, example instances:

 -- Singleton class

 class Singleton l where
   type SingletonItem l
   singleton :: SingletonItem l - l

 -- Singleton instances

 instance Singleton [a] where
   type SingletonItem [a] = a
   singleton a = [a]

 instance (Ord a) = Singleton (Set a) where
   type SingletonItem (Set a) = a
   singleton = Set.singleton

 instance (Ord k) = Singleton (Map k v) where
   type SingletonItem (Map k v) = (k,v)
   singleton (k,v) = Map.singleton k v

 instance Singleton (IntMap v) where
   type SingletonItem (IntMap v) = (Int,v)
   singleton (k,v) = IntMap.singleton k v

 instance Singleton Text where
   type SingletonItem Text = Char
   singleton = Text.singleton

 -- GenericEnum class

 class GenericEnum l where
   type EnumItem l
   genericEnumFrom:: EnumItem l - l
   genericEnumFromThen:: EnumItem l - EnumItem l - l
   genericEnumFromTo  :: EnumItem l - EnumItem l - l
   genericEnumFromThenTo  :: EnumItem l - EnumItem l - EnumItem l - l

 -- GenericEnum instances

 instance (Enum a) = GenericEnum [a] where
   type EnumItem [a] = a
   genericEnumFrom= enumFrom
   genericEnumFromThen= enumFromThen
   genericEnumFromTo  = enumFromTo
   genericEnumFromThenTo  = enumFromThenTo

 instance (Ord a,Enum a) = GenericEnum (Set a) where
   type EnumItem (Set a) = a
   genericEnumFrom   a = Set.fromList (enumFrom a)
   genericEnumFromThen   a b   = Set.fromList (enumFromThen a b)
   genericEnumFromTo a b   = Set.fromList (enumFromTo a b)
   genericEnumFromThenTo a b c = Set.fromList (enumFromThenTo a b c)

 instance (Ord k,Enum (k,v)) = GenericEnum (Map k v) where
   type EnumItem (Map k v) = (k,v)
   genericEnumFrom   a = Map.fromList (enumFrom a)
   genericEnumFromThen   a b   = Map.fromList (enumFromThen a b)
   genericEnumFromTo a b   = Map.fromList (enumFromTo a b)
   genericEnumFromThenTo a b c = Map.fromList (enumFromThenTo a b c)

 instance (Enum (Int,v)) = GenericEnum (IntMap v) where
   type EnumItem (IntMap v) = (Int,v)
   genericEnumFrom   a = IntMap.fromList (enumFrom a)
   genericEnumFromThen   a b   = IntMap.fromList (enumFromThen a b)
   genericEnumFromTo a b   = IntMap.fromList (enumFromTo a b)
   genericEnumFromThenTo a b c = IntMap.fromList (enumFromThenTo a b c)

 instance GenericEnum Text where
   type EnumItem Text = Char
   genericEnumFrom   a = Text.pack (enumFrom a)
   genericEnumFromThen   a b   = Text.pack (enumFromThen a b)
   genericEnumFromTo a b   = Text.pack (enumFromTo a b)
   genericEnumFromThenTo a b c = Text.pack (enumFromThenTo a b c)

 Note that the GenericEnum 

Re: [Haskell-cafe] Organizaing tests in Haskell

2012-09-24 Thread Heinrich Apfelmus

Simon Hengel wrote:

On Sun, Sep 23, 2012 at 06:11:59PM +0200, Heinrich Apfelmus wrote:


How do I access internal modules with  cabal test , though? Last
time I tried, I could not find a way to expose in the test section
of the cabal file.


It works, if you add the source directory to hs-source-dirs of the test
suite (in contrast to depending on the library!), e.g.:

  hs-source-dirs: test, src

or

  hs-source-dirs: test, .

This still has the disadvantage, that the sources are compiled twice.
But I'm not aware of a better way to do it.  If you mostly use GHCi for
development, it's not a big issue.


I got it to work, thanks!

I also had to duplicate the dependency information, but that's alright.


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Heinrich Apfelmus

Roman Cheplyaka wrote:

* Heinrich Apfelmus apfel...@quantentunnel.de [2012-09-23 10:51:26+0200]

Unfortunately, making literals polymorphic does not always achieve
the desired effect of reducing syntax. In fact, they can instead
increase syntax! In other words, I would like to point out that there
is a trade-off involved: is it worth introducing a small syntactic
reduction at the cost of both a small additional conceptual
complexity and some syntactic enlargement elsewhere?


Can't you just disable the extension when you realise that it
makes your life harder?


I thought so, too, but there is actually a social catch.

Namely, a library/DSL can be designed with that extension in mind and 
advocate its use. The [scotty][] library is an example for this.


In particular, the  RoutePattern  type is made an instance of  IsString 
 and the example code uses it extensively. If I want to disable the 
extension, I have to translate the example code first. When learning a 
library for the first time, this can be rather confusing.


  [scotty]: http://hackage.haskell.org/package/scotty

Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: New wiki page and mailing list for combinatorics and Haskell

2012-09-24 Thread Brent Yorgey
Quite a while ago there was a mailing list thread where the idea was
brought up of creating a mailing list for those interested in
combinatorics in the setting of Haskell.

Well, I've finally gotten around to it.  If you're interested in
(probably extremely low-traffic) discussion and announcements relating
to doing combinatorics in Haskell (computing combinatorial/
number-theoretic functions; exhaustive or random generation of
combinatorial objects; type algebra; etc.), please join!  

  http://projects.haskell.org/cgi-bin/mailman/listinfo/combinatorics

There is also a wiki page for collecting information here:

  http://www.haskell.org/haskellwiki/Combinatorics

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Partial statical linking

2012-09-24 Thread Brandon Allbery
On Mon, Sep 24, 2012 at 7:42 AM, Jason Dusek jason.du...@gmail.com wrote:

 I am not sure why that happens -- libgcc.a wasn't explicitly
 asked for; but it stands to reason that one shouldn't specify


No, but it's required for anything that uses the C compiler (which in this
case would be glibc and any foreign libraries) --- it contains the
implementation of things like (long long) support on 32-bit platforms,
exception unwinding, and other compiler intrinsics.  You may not use them
but glibc does.

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Getting started with Shake

2012-09-24 Thread Evan Laforge
 With shake I'm not sure exactly how to get started.  Should I have a
 separate project where I create the build system for the webapp?  Or
 can I setup something similar to sbt?

 Also, how do I handle dependencies with shake?  cabal will pull in
 packages from hackage and do the needful, is there anything in shake
 to do the same?  If not, how is it normally done?

I have a Shake directory in the project toplevel.  It has Shakefile.hs
and various other utility modules.  A shell script called mkmk
rebuilds the shakefile: 'exec runghc Shake/Shakefile.hs $@
build/opt/shakefile', and I usually use 'mk', which is another shell
script: 'exec build/opt/shakefile $@'.  You could use runghc all the
time, but I have a large project and interpreting the shakefile is
noticeably slower.

For dependencies I have HsDeps and CcDeps modules which do the minimal
amount of parsing to pull out 'import qualified XYZ' or '#include
something.h' lines.  The hs link rule uses it to get the transitive
imports of a binary to 'need' them, and the *.hs.o rule uses it to get
the direct imports of the file it's compiling.  Same story for the
*.cc.o rule and C++ binaries.

There are extra wrinkles for CPP-using hs file and FFI using files
that depend on C wrappers, and multiple build modes (debug, opt,
profile, test) but that's the gist of it.

I don't have a cabal file, just an INSTALL file that I can copy paste
into cabal install.  In the future I'll probably have a cabal file
that doesn't actually compile, just gives deps and their versions, but
so far copy pasting a bunch of stuff into cabal install hasn't been a
big deal.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Roman Leshchinskiy
Michael Snoyman wrote:

 The simplest example I can think of is allowing easier usage of Vector:

 [1, 2, 3] :: Vector Int

 In order to allow this, we could use a typeclass approach similar to
 how OverloadedStrings works:

 class IsList a where
 fromList :: [b] - a b
 instance IsList Vector where
 fromList = V.fromList
 foo :: Vector Int
 foo = fromList [1, 2, 3]

I remember a similar discussion a few years ago. The question of whether
or not overloading list literals a good idea notwithstanding, the problem
with this is that fromList for vectors is highly inefficient. So if
something like this gets implemented and if vector/array literals are one
of the main motivations then I really hope there will be no lists
involved.

Roman




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Simon Peyton-Jones
|  Many of us use the OverloadedStrings language extension on a regular
|  basis. It provides the ability to keep the ease-of-use of string
|  literal syntax, while getting the performance and correctness
|  advantages of specialized datatypes like ByteString and Text. I think
|  we can get the same kind of benefit by allowing another literal syntax
|  to be overloaded, namely lists.  

Interestingly, Achim Krause, George Giorgidze and Jeroen Weijers have been 
thinking about this very question.  They have most of an implementation too. 
I'm ccing them so they can post a status update.

Your email broadens the topic somewhat; I don't think we'd considered 
overloading for maps too, though I can see it makes sense.  I'd much prefer the 
type-family solution (with a single-parameter type class) to the fundep one, if 
we go that route.

This topic deserves its own page on the GHC wiki, if someone wants to start one.

If we can evolve a design consensus, I'm happy to incorporate the result in GHC.

Simon


|  -Original Message-
|  From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-
|  boun...@haskell.org] On Behalf Of Michael Snoyman
|  Sent: 23 September 2012 05:07
|  To: Haskell Cafe
|  Subject: [Haskell-cafe] Call for discussion: OverloadedLists extension
|  
|  (Prettier formatting available at: https://gist.github.com/3761252)
|  
|  Many of us use the OverloadedStrings language extension on a regular
|  basis. It provides the ability to keep the ease-of-use of string
|  literal syntax, while getting the performance and correctness
|  advantages of specialized datatypes like ByteString and Text. I think
|  we can get the same kind of benefit by allowing another literal syntax
|  to be overloaded, namely lists.  
|  
|  ## Overly simple approach
|  
|  The simplest example I can think of is allowing easier usage of Vector:
|  
|  [1, 2, 3] :: Vector Int
|  
|  In order to allow this, we could use a typeclass approach similar to
|  how OverloadedStrings works:
|  
|  class IsList a where
|  fromList :: [b] - a b
|  instance IsList Vector where
|  fromList = V.fromList
|  foo :: Vector Int
|  foo = fromList [1, 2, 3]
|  
|  ## Flaws
|  
|  However, such a proposal does not allow for constraints, e.g.:
|  
|  instance IsList Set where
|  fromList = Set.fromList
|  
|  No instance for (Ord b)
|arising from a use of `Set.fromList'
|  In the expression: Set.fromList
|  In an equation for `fromList': fromList = Set.fromList
|  In the instance declaration for `IsList Set'
|  
|  Additionally, it provides for no means of creating instances for
|  datatypes like Map, where the contained value is not identical to the
|  value contained in the original list. In other words, what I'd like to
|  see is:
|  
|  [(foo, 1), (bar, 2)] :: Map Text Int
|  
|  ## A little better: MPTC
|  
|  A simplistic approach to solve this would be to just use 
MultiParamTypeClasses:
|  
|  class IsList input output where
|  fromList :: [input] - output
|  instance IsList a (Vector a) where
|  fromList = V.fromList
|  foo :: Vector Int
|  foo = fromList [1, 2, 3]
|  
|  Unfortunately, this will fail due to too much polymorphism:
|  
|  No instance for (IsList input0 (Vector Int))
|arising from a use of `fromList'
|  Possible fix:
|add an instance declaration for (IsList input0 (Vector Int))
|  In the expression: fromList [1, 2, 3]
|  In an equation for `foo': foo = fromList [1, 2, 3]
|  
|  This can be worked around by giving an explicit type signature on the
|  numbers in the list, but that's not a robust solution. In order to
|  solve this properly, I think we need either functional dependencies or
|  type families:
|  
|  ## Functional dependencies
|  
|  class IsList input output | output - input where
|  fromList :: [input] - output
|  instance IsList a (Vector a) where
|  fromList = V.fromList
|  instance Ord a = IsList a (Set a) where
|  fromList = Set.fromList
|  instance Ord k = IsList (k, v) (Map k v) where
|  fromList = Map.fromList
|  
|  foo :: Vector Int
|  foo = fromList [1, 2, 3]
|  
|  bar :: Set Int
|  bar = fromList [1, 2, 3]
|  
|  baz :: Map String Int
|  baz = fromList [(foo, 1), (bar, 2)]
|  
|  ## Type families
|  
|  class IsList a where
|  type IsListInput a
|  fromList :: [IsListInput a] - a
|  instance IsList (Vector a) where
|  type IsListInput (Vector a) = a
|  fromList = V.fromList
|  instance Ord a = IsList (Set a) where
|  type IsListInput (Set a) = a
|  fromList = Set.fromList
|  instance Ord k = IsList (Map k v) where
|  type IsListInput (Map k v) = (k, v)
|  fromList = Map.fromList
|  
|  foo :: Vector Int
|  foo = fromList [1, 2, 3]
|  
|  bar :: Set Int
|  bar = fromList [1, 

Re: [Haskell-cafe] Call for discussion: OverloadedLists extension

2012-09-24 Thread Simon Peyton-Jones
|  I remember a similar discussion a few years ago. The question of whether
|  or not overloading list literals a good idea notwithstanding, the problem
|  with this is that fromList for vectors is highly inefficient. So if
|  something like this gets implemented and if vector/array literals are one
|  of the main motivations then I really hope there will be no lists
|  involved.

Would you like to remind us why it is so inefficient?  Can't the vector 
construction be a fold over the list?  Ah... you need to know the *length* of 
the list, don't you?  So that you can allocate a suitably-sized vector.  Which 
of course we do for literal lists.

So what if fromList went
fromList :: Int - [b] - a b
where the Int is the length of the list?

Simon


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] Well-Typed and Skills Matter offer Haskell courses in London in October

2012-09-24 Thread Claude Heiland-Allen

Hi Andres, list,

On 19/09/12 09:41, Andres Löh wrote:

Oops, I hit send too prematurely, sorry for the seeming bluntness (but it is
still a blunt message, can't apologize for that I suppose):


No need to apologize. There's a need for informal meetings as much (or
even more) as there is for courses and conferences.


Thank you.


Regarding London, I know there's the
Haskell Hoodlums meetup (http://www.meetup.com/hoodlums/)


Thanks, I wasn't aware of this one.  I have signed up.


Claude

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe