[Haskell-cafe] Richard Bird and the fast nub function

2013-09-29 Thread Henning Thielemann


In Richard Bird's Functional Pearls in Algorithm Design there is chapter 
10 Removing duplicates which is about a fast and sorting variant of 
'nub'. After reading the introduction of the chapter I answered mentally 
Set.toAscList . Set.fromList - next chapter please. However after the 
introduction eight pages follow that develop an efficient algorithm for 
the problem. I suspected there might be the additional difficulty of not 
using the standard Set type, however on page 70 the common Set API is 
imported. In the final remarks of the chapter Bird writes: A nagging 
doubt remains that there might be a much simpler solution to such a simply 
stated problem. But so far I have not been able to find one. Now I am 
lost. Can someone tell me, how the task differs from what Set.toAscList . 
Set.fromList does?

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


Re: [Haskell-cafe] [Haskell] ANN: Cabal v1.18.0 released

2013-09-16 Thread Henning Thielemann


On Wed, 4 Sep 2013, Johan Tibell wrote:


* GHCi support. It's now much easier to use ghci when developing your
packages, especially if those packages require preprocessors (e.g.
hsc2hs).


That's a great feature! How can I configure Cabal to start ghci with 
certain options? I like to enable more warnings. I could not find a 
documentation for the Cabal config file.

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


Re: [Haskell-cafe] sequence causing stack overflow on pretty small lists

2013-08-28 Thread Henning Thielemann


On Tue, 27 Aug 2013, John Lato wrote:


[1] Most people are physically incapable of reading documents that explain why 
what they want to do won't
work.  Even if people did read the documentation, I suspect that the people 
most in need of the information
would be the least likely to understand how it applies to their situation.


Plus: I don't expect that programmers read the documentation of 'sequence' 
and 'mapM' again every time they use the function.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Extending Type Classes

2013-08-26 Thread Henning Thielemann


 The problem of refinement of type classes annoys me from time to time 
when I work on the NumericPrelude. It is an experimental type class 
hierarchy for mathematical types. Sometimes a new data type T shall be 
implemented and it turns out that you can implement only a part of all 
methods of a certain class. Then a natural step is to split the class into 
two classes A and B: 'A' contains the methods we can implement for T and 
'B' contains the remaining methods and 'B' is a sub-class of 'A'.
 First, this means that all client code has to be rewritten. Second, code 
for instances becomes very lengthy, because over the time code tends to 
contain one instances for every method. However the many small instances 
actually carry information: Every instance has its specialised 
constraints. E.g. you would certainly try to use only Applicative 
constraints in an Applicative instance and not Monad constraints. However, 
if there is a way to define Applicative and Monad instances in one go, the 
Applicative instance may get Monad constraints.


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


[Haskell-cafe] GHC and backwards compatibility

2013-08-21 Thread Henning Thielemann

If you use

$ cabal install --constraint=array installed

then cabal-install is forced to use the installed version of array. If a 
package conflicts with this version, then it will report the conflicting 
packages.


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


Re: [Haskell-cafe] Renumbered mailing list posts

2013-08-11 Thread Henning Thielemann

Am 10.08.2013 21:48, schrieb Austin Seipp:

Henning,

Thanks for the report. I'm currently investigating this, and think it
should be possible to keep all of the old URLs intact.


Thank you! This would be really really great!


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


[Haskell-cafe] Renumbered mailing list posts

2013-08-10 Thread Henning Thielemann
Recently I found that links from Google search results to archive 
Haskell-Cafe messages are invalid. The messages are still there, but got 
a different number. E.g. the search result says:

  http://www.haskell.org/pipermail/haskell-cafe/2011-February/089455.html

But the message is at
  http://www.haskell.org/pipermail/haskell-cafe/2011-February/088146.html

Also links from Haskell-Wiki articles to the Haskell-Cafe archive are 
invalid now. This is very very very bad, since I used tons of such URLs 
in Wiki articles and it is very hard to find the message I referred to, 
if the URL does not work anymore.


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


Re: [Haskell-cafe] [Haskell] ANN: Monad.Reader Issue 22

2013-08-08 Thread Henning Thielemann


On Wed, 7 Aug 2013, Edward Z. Yang wrote:


I am pleased to announce that Issue 22 of the Monad Reader is now available.

   http://themonadreader.files.wordpress.com/2013/08/issue22.pdf

Issue 22 consists of the following two articles:

 * Generalized Algebraic Data Types in Haskell by Anton Dergunov
 * Error Reporting Parsers: a Monad Transformer Approach by Matt Fenwick and 
Jay Vyas
 * Two Monoids for Approximating NP-Complete Problems by Mike Izbicki


That is, there are three kinds of Haskellers: The ones who can count and 
the others who cannot. :-)


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


Re: [Haskell-cafe] [Haskell] [ANN] Initial release of the threepenny-gui library, version 0.1.0.0

2013-07-21 Thread Henning Thielemann


On Sun, 21 Jul 2013, Sergey Mironov wrote:


Hi, I have a Path problem when installing threepenny-gui from Hackage.
Probably somtething trivial.


I have written a small script cabal-upload that tries to compile a package 
before uploading it to Hackage. That helps to assert that all required 
files are registered in the cabal file.


http://hackage.haskell.org/package/cabal-scripts

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


[Haskell-cafe] meaning of referential transparency

2013-04-06 Thread Henning Thielemann


Can someone enlighten me about the origin of the term referential 
transparency? I can lookup the definition of referential transparency 
in the functional programming sense in the Haskell Wiki and I can lookup 
the meaning of reference and transparency in a dictionary, but I don't 
know why these words were chosen as name for this defined property.


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


[Haskell-cafe] closed world instances, closed type families

2013-04-02 Thread Henning Thielemann


Recently I needed to define a class with a restricted set of instances. 
After some failed attempts I looked into the DataKinds extension and in 
Giving Haskell a Promotion I found the example of a new kind Nat for 
type level peano numbers. However the interesting part of a complete case 
analysis on type level peano numbers was only sketched in section 8.4 
Closed type families. Thus I tried again and finally found a solution 
that works with existing GHC extensions:


data Zero
data Succ n

class Nat n where
   switch ::
  f Zero -
  (forall m. Nat m = f (Succ m)) -
  f n

instance Nat Zero where
   switch x _ = x

instance Nat n = Nat (Succ n) where
   switch _ x = x


That's all. I do not need more methods in Nat, since I can express 
everything by the type case analysis provided by switch. I can implement 
any method on Nat types using a newtype around the method which 
instantiates the f. E.g.


newtype
   Append m a n =
  Append {runAppend :: Vec n a - Vec m a - Vec (Add n m) a}

type family Add n m :: *
type instance Add Zero m = m
type instance Add (Succ n) m = Succ (Add n m)

append :: Nat n = Vec n a - Vec m a - Vec (Add n m) a
append =
   runAppend $
   switch
  (Append $ \_empty x - x)
  (Append $ \x y -
  case decons x of
 (a,as) - cons a (append as y))


decons :: Vec (Succ n) a - (a, Vec n a)

cons :: a - Vec n a - Vec (Succ n) a



The technique reminds me on GADTless programming. Has it already a name?

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


Re: [Haskell-cafe] closed world instances, closed type families

2013-04-02 Thread Henning Thielemann


On Tue, 2 Apr 2013, Daniel Peebles wrote:


It seems very similar to Ryan Ingram's post a few years back
(pre-TypeNats): 
http://www.haskell.org/pipermail/haskell-cafe/2009-June/062690.html
The main difference is that he introduces the knowledge about zero vs. suc as 
a constraint, and you introduce
it as a parameter. In fact, his induction function (which is probably what I'd 
call it too) is almost identical
to your switch.


The answer to his post by Miguel Mitrofanov contains a caseNat that is 
exactly my 'switch'. I see I am four years late.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-03-29 Thread Henning Thielemann


On Fri, 29 Mar 2013, Niklas Hambüchen wrote:


(This is a slightly detailed email. If you are the maintainer of one of
the packages benchmarked here, you might want to read it though.)


Could you please put your experiences the Wiki? This would help others to 
choose a package.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-03-29 Thread Henning Thielemann


On Fri, 29 Mar 2013, Louis Wasserman wrote:


Bearing in mind that I haven't looked at this in several years...
 Why did you switch from queuelike to pqueue?

Because I liked the API better?

 Could you put the code up somewhere manageable (repo)?

I had it up on darcs, but since that's not there any more, I don't have any 
more source history than you do.


Was it on code.haskell.org? Then it might have been moved to a non-web 
directory after the last attack 2011.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: psqueue-benchmarks - benchmarks of priority queue implementations

2013-03-29 Thread Henning Thielemann


On Fri, 29 Mar 2013, Niklas Hambüchen wrote:


On 29/03/13 20:14, Henning Thielemann wrote:

Was it on code.haskell.org? Then it might have been moved to a non-web
directory after the last attack 2011.


Does that mean the repo is still there without web access


I assume that.


or gone?


If the original author has not deleted it, then it should still be 
somewhere:


http://www.haskell.org/pipermail/haskell-cafe/2011-February/089352.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: monad-bool 0.1

2013-01-22 Thread Henning Thielemann


On Tue, 22 Jan 2013, John Wiegley wrote:


Use 'onlyIf' with AndM and AndMT to guard later statements, which are only
evaluated if every preceding 'onlyIf' evaluates to True.  For example:

   foo :: AndM Int
   foo = do onlyIf (True == True)
return 100
onlyIf (True == True)
return 150
onlyIf (True == False)
return 200

When run with `evalAndM foo (-1)` (where (-1) provides a default value), 'foo'
returns 150.


Does the And monad fulfill the monad laws? In a proper monad an interim 
(return x) (without a '-') is a no-op.


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


Re: [Haskell-cafe] [Haskell] Silent error

2013-01-20 Thread Henning Thielemann


On Mon, 21 Jan 2013, mip...@meta.ua wrote:


The program looks like this:

--***
factorial :: Int-Int
factorial n = product [1..n]

main = do
   print $ factorial 50
--***

And that yields 0 (no errors). Is it a bug or feature? :)


This question is certainly better posted to haskell-cafe.

The answer is: Int has limited bitsize (32 ord 64 bit depending on your 
machine), thus it computes factorial modulo 2^32 or 2^64. You can get the 
correct result by replacing Int by Integer.


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


Re: [Haskell-cafe] [Haskell] Importing Repa library

2013-01-03 Thread Henning Thielemann


On Thu, 3 Jan 2013, Емануела Моллова wrote:


Hello! :)


I think you should better post your question to haskell-cafe@haskell.org.


Then I put this script 

import qualified Data.Array.Repa as R
:m +Data.Array.Repa
Z

into the file file.hs,


This is GHCi syntax, but it is not a valid Haskell module as indicated by 
the .hs filename extension.



opened WinGHCi and loaded the file, and then evaluated it, but what I get is: 

Could not find module `Data.Array.Repa'
Perhaps you meant
Data.Array.Base (from array-0.4.0.0)
Data.Array.IO (from array-0.4.0.0)
Data.Array.ST (from array-0.4.0.0)
Use -v to see a list of the files searched for.
Failed, modules loaded: none.


I wonder why it loads file.hs at all. I would expect that it gives a 
syntax error.




Also ghc-pkg list repa says:

WARNING: cache is out of date: C:/Program Files/Haskell 
Platform/2012.4.0.0\lib\package.conf.d\package.cache
use 'ghc-pkg recache' to fix. C:/Program Files/Haskell 
Platform/2012.4.0.0\lib\package.conf.d:
C:\Users\Faery\AppData\Roaming\ghc\i386mingw32-7.4.2\package.conf.d:



Since 'repa' is not listed, it was not installed successfully. This would 
be consistent with the Could not find module message of GHCi. You may 
post the output of the 'cabal install repa' run.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mtl-2.1 severly broken, cabal needs blacklisting

2012-11-14 Thread Henning Thielemann


On Wed, 14 Nov 2012, Jean-Philippe Bernardy wrote:


On Tue, Nov 13, 2012 at 11:39 PM, Andreas Abel andreas.a...@ifi.lmu.de wrote:
  On 13.11.12 11:13 PM, Jean-Philippe Bernardy wrote:
Blacklisting equals releasing a bugfix.


Not quite.


I propose to *define* blacklisting as such. 

package-X.Y.Z.W is blacklisted if there exists package-X.Y.Z.V where V  W
(maybe I'm off by one position in the  version number scheme here, but you get 
the idea)


This rule is correct for packages following the Package Versioning Policy.
Currently cabal-install and Cabal make no assumptions about the employed 
versioning scheme.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] mtl-2.1 severly broken, cabal needs blacklisting

2012-11-13 Thread Henning Thielemann


On Tue, 13 Nov 2012, Bas van Dijk wrote:


On 13 November 2012 17:27, Andreas Abel andreas.a...@ifi.lmu.de wrote:

This calls for a means of blacklisting broken or malicious packages.

  cabal update

should also pull a blacklist of packages that will never be selected by
cabal install (except maybe by explicit user safety overriding).


Maybe we can use the existing preferred-versions file that cabal-install uses:

http://hackage.haskell.org/packages/archive/preferred-versions


It is also possible to deprecate a package. Is it possible to deprecate a 
single version? I'm afraid that the user is also not warned if he installs 
a deprecated package.


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


Re: [Haskell-cafe] ANN: data-dword: Long binary words from short ones

2012-10-11 Thread Henning Thielemann


On Thu, 11 Oct 2012, Mikhail Vorozhtsov wrote:

I'm pleased to announce my new little library, data-dword[1]. It provides 
Template Haskell utilities for defining binary word data types from low and 
high halves, e.g.


data Word96 = Word96 Word32 Word64 -- strictness is configurable
data Int96 = Int96 Int32 Word64


What is the advantage over 'largeword' which does the same with plain 
Haskell 98?


http://hackage.haskell.org/package/largeword

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


Re: [Haskell-cafe] total Data.Map.! function

2012-10-09 Thread Henning Thielemann


Hi Joachim,


On Wed, 5 Oct 2012, Joachim Breitner wrote:


On Wed, 3 Oct 2012, Henning Thielemann wrote:

I wondered whether there is a brilliant typing technique that makes 
Data.Map.! a total function. That is, is it possible to give (!) a 
type, such that m!k expects a proof that the key k is actually present 
in the dictionary m? How can I provide the proof that k is in m?
 Same question for 'lab' (import Data.Graph.Inductive(lab)). That is, 
can there be a totalLab, with (totalLab gr = fromJust . lab gr) that 
expects a proof that the node Id is actually contained in a graph?


I think it is possible to do this using the same trick that ST is using, 
i.e. rank 2 types. The problem is that this code is likely to be 
unwieldy to use, as the variable needs to change with every change to 
the map – but I guess if you create your map once and then use it in 
various places without modification, this can actually work.


 Thank you for your detailed answer! I thought about such a tagging method 
but was missing your idea of updating tags of existing keys in order to 
reflect the knowledge about newly added keys.
 Your solution will certainly work for the set of methods you have 
implemented. All of your methods extend the set of keys or preserve it. 
But what about deletion? The certificate that key k is contained in a Map 
must be invalidated by the deletion of k. How could I add this to your 
approach?
 Maybe I should track the operations applied to the keys of a map and 
provide algebraic simplifications, like so:


   insert ::
  Ord k =
  Tagged s k - v - Tagged m (Map k v) -
  Tagged (Insert s m) (Map k v)

   lookup ::
  Ord k =
  Tagged s k - Tagged (Insert s m) (Map k v) - v

   -- * example simplifications

   commuteInsert ::
  Tagged (Insert s0 (Insert s1 m)) (Map k v) -
  Tagged (Insert s1 (Insert s0 m)) (Map k v)

   simplifyInsertInsert ::
  Tagged (Insert s (Insert s m)) (Map k v) -
  Tagged (Insert s m) (Map k v)

   simplifyInsertDelete ::
  Tagged (Insert s (Delete s m)) (Map k v) -
  Tagged (Insert s m) (Map k v)

   simplifyDeleteInsert ::
  Tagged (Delete s (Insert s m)) (Map k v) -
  Tagged (Delete s m) (Map k v)


   example =
  lookup k0 $ commuteInsert $
  insert k1 for $ insert k0 bar m


 I also thought about something like the exceptions trick. That is, a 
context like


   (ContainsKeyA k, ContainsKeyB k) = Map k x

 might tell that certain keys are in the Map. However, this would not only 
mean that I need a type class for every insertion, it would also not work 
reliably for deletion. If keyA = keyB, then deletion of keyA must also 
remove the ContainsKeyB constraint. :-(


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


[Haskell-cafe] total Data.Map.! function

2012-10-03 Thread Henning Thielemann


 I wondered whether there is a brilliant typing technique that makes 
Data.Map.! a total function. That is, is it possible to give (!) a type, 
such that m!k expects a proof that the key k is actually present in the 
dictionary m? How can I provide the proof that k is in m?
 Same question for 'lab' (import Data.Graph.Inductive(lab)). That is, can 
there be a totalLab, with (totalLab gr = fromJust . lab gr) that expects a 
proof that the node Id is actually contained in a graph?


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


Re: [Haskell-cafe] [Haskell] A riddle...

2012-07-17 Thread Henning Thielemann


On Mon, 16 Jul 2012, Felipe Almeida Lessa wrote:


On Mon, Jul 16, 2012 at 12:33 PM, Vo Minh Thu not...@gmail.com wrote:

It seems like the infered type (and thus bounds) is different when you
force the result to be a Color or not. Just give explicit type
signatures and conversion functions.


Actually, just *always* give explicit type signatures.


Additionally, always compile with '-Wall' and follow the warnings. This 
way GHC will also warn about missing type signatures and it will even 
suggest type signatures.


(and use haskell-cafe for riddles, please :-)

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


Re: [Haskell-cafe] Sifflet type checker

2012-07-09 Thread Henning Thielemann


On Mon, 9 Jul 2012, gdwe...@iue.edu wrote:


data Type = TypeVar TypeVarName  -- named type variable
 | TypeCons TypeConsName [Type] -- constructed type
   deriving (Eq)

Do you still think my type checker would be useful to you,
or to Haskellers generally?


I see. Then it is probably not very useful for me. :-(



[1] http://www.youtube.com/watch?v=sXywCHR9WwE


Ah, I enjoyed the performance!


Nice to hear that you like it!

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: Sifflet visual programming language, release 2.0.0.0

2012-07-07 Thread Henning Thielemann


On Thu, 5 Jul 2012, gdwe...@iue.edu wrote:


Sifflet and sifflet-lib 2.0.0.0, now available on Hackage!

This version introduces a type checker and partial support
for higher order functions in Sifflet, the visual, functional
programming language and support system for students learning
about recursion.


You have implemented your own type-checker, right? I plan to add a 
type-checker to our live-sequencer project. [1] So far I have thought 
about using the Helium type checker but I have not done it so far. If you 
want to make your type-checker useful for other projects, you may put it 
into a separate package without the hard to install dependencies on cairo 
and glib.


[1] http://www.youtube.com/watch?v=sXywCHR9WwE

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: lens-family-th 0.1.0.0

2012-07-07 Thread Henning Thielemann


On Sat, 7 Jul 2012, rocon...@theorem.ca wrote:


On Fri, 6 Jul 2012, Dan Burton wrote:

Following the announcement of lens-family, I'm pleased to announce 
lens-family-th 0.1.0.0, a Template Haskell library supplying macros to 
generate

lens-family lenses for fields of data types declared with record syntax.

Be warned that currently, type signatures are *not* generated alongside the 
lens definitions. Type inference should correctly determine the type of the
generated lenses, but I have structured the library code so that in the 
future, type signatures can also be generated. Patches welcome!


http://hackage.haskell.org/package/lens-family-th


I cannot help but wonder if it is better to *not* generate type signatures 
(or at least have an option not to).


In data-accessor-template we generate type signatures, also because it 
avoids warnings for missing type signatures. However it needed some 
fine-tuning before it worked in all cases.



At the moment one can write:


import Lens.Family2.Stock
import Lens.Family2.TH

data Foo a = Foo { _bar :: Int, _baz :: a }
   deriving (Show, Read, Eq, Ord)
$(mkLenses ''Foo)

-- | My documentation for the 'bar' lens.
bar :: Lens (Foo a) Int

-- | My documentation for the 'baz' lens.
baz :: LensFamily (Foo a) (Foo a') a a'


I don't know if it is possible to add haddock to functions whose type 
signatures are generated by template haskell.


Could the documentation be an argument of mkLenses?

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: lens-family-th 0.1.0.0

2012-07-07 Thread Henning Thielemann


On Sat, 7 Jul 2012, Dan Burton wrote:


  Could the documentation be an argument of mkLenses?

 Does haddock run on the template-haskell expanded code?
 
TH macros must have type Q [Dec]. Dec has no constructor for comments, with the 
exception of pragmas. This
might be feature request worthy, though it is a rather strange case to want to 
generate comments via a macro.


Alternatively, Haddock allows you to document functions in the export 
list.


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


Re: [Haskell-cafe] [Haskell] [ANN] GenCheck - a generalized property-based testing framework

2012-06-20 Thread Henning Thielemann


On Tue, 19 Jun 2012, Jacques Carette wrote:


Its main novel features are:

* introduces a number of /testing strategies/ and /strategy combinators/
* introduces a variety of test execution methods
* guarantees uniform sampling (at each rank) for the random strategy
* guarantees both uniqueness and coverage of all structures for the
  exhaustive strategy
* introduces an /extreme/ strategy for testing unbalanced structures
* also introduces a /uniform/ strategy which does uniform sampling
  along an enumeration
* allows different strategies to be mixed; for example one can
  exhaustively test all binary trees up to a certain size, filled with
  random integers.
* complete separation between properties, generators, testing
  strategies and test execution methods



This sounds very interesting to me since I had a lot of trouble with 
changed test case distributions when switching from QuickCheck-1 to 
QuickCheck-2. It was mainly that tested numbers became much bigger in 
QuickCheck-2 and if I used the numbers as size of lists, then tests could 
not be run in reasonable time anymore. Thus I think more control over 
test-case generation is necessary.


QuickCheck is Haskell-98 and thus is very portable. I see that GenCheck 
needs some more extensions - type families, multi-parameter type classes, 
what else?


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


[Haskell-cafe] relocation R_X86_64_PC32 against undefined symbol

2012-06-20 Thread Henning Thielemann


Just for the record:

I compiled with GHC and got the linker error:

/usr/bin/ld: dist/build/.../Module.dyn_o: relocation R_X86_64_PC32 against 
undefined symbol `..._xyz1_closure' can not be used when making a shared 
object; recompile with -fPIC



Problem was that I forgot to declare Module in the Cabal description.

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


Re: [Haskell-cafe] converting functional dependencies to type families

2012-06-11 Thread Henning Thielemann


On Mon, 11 Jun 2012, Simon Peyton-Jones wrote:


Thanks.  I've linked to it from
http://www.haskell.org/haskellwiki/GHC/Type_families#Frequently_asked_questions


Thank you! I already added this and another link to a new See also 
section below. Which one shall we maintain?


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


Re: [Haskell-cafe] converting functional dependencies to type families

2012-06-10 Thread Henning Thielemann


On Thu, 7 Jun 2012, Simon Peyton-Jones wrote:


Very useful!  Maybe worth turning into a page on the Haskell wiki?


I created one:
  http://www.haskell.org/haskellwiki/Functional_dependencies_vs._type_families

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


[Haskell-cafe] HaL7: Haskell-Treffen in Halle/Saale, Freitag 2012-07-13

2012-06-06 Thread Henning Thielemann


For our German readers:

Es ist wieder so weit: Am Freitag, 13. Juli laden wir zum 7. Haskell-Treffen 
HaL ein, diesmal nach Halle an der Saale. Wir bieten eine bunte Mischung aus 
Tutorien zum Mitmachen, Vortraegen zum Anhoeren und Gelegenheiten zum 
Fachsimpeln, theoretisches wie praktisches, ernstes wie heiteres.


Das Programm im Schnelldurchlauf ist:

   vormittags 6 Tutorien
  09:30 - 11:00  snap  repa  schule
  11:30 - 13:00  reactive  generics  liveseq

   nachmittags 4 Vortraege
  14:30 - 15:15  Dorn: Schule
  15:15 - 16:00  Voigtlaender: ADP
  16:30 - 17:15  Goergens: XenClient
  17:15 - 18:00  Eijkel: Hommage

   sonstiges:
  09:00 - 11:30  Installationshilfen
  11:00 - 11:30  Kaffeepause
  13:00 - 14:30  Mittagspause
  16:00 - 16:30  Kaffeepause
  19:00 - Ende   Abendessen und Fachsimpelei im Restaurant


Die Details finden Sie hier:
  http://iba-cg.de/hal7.html

und die Anmeldung da:
  http://sim.mathematik.uni-halle.de:8080/hal7/


Bitte melden Sie sich bis zum 4. Juli an.

Wir freuen uns auf Ihr zahlreiches Erscheinen!

für das Programmkomitee
Henning Thielemann

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


[Haskell-cafe] converting functional dependencies to type families

2012-06-05 Thread Henning Thielemann


Hi all,

when I reported a typechecker performance problem related to functional 
dependencies

   http://hackage.haskell.org/trac/ghc/ticket/5970
 I promised to try to convert from functional dependencies to type 
families.


Thus I converted my code and the llvm package to type-families:
   http://code.haskell.org/~thielema/llvm-tf/


Here are some of my experiences:

== Advantages of TypeFamilies ==

* Speed

For what I did the type families solution was considerably faster than the 
functional dependencies code at least in GHC-7.4.1. Thus the bug in ticket 
5970 does no longer hurt me. (In GHC-6.12.3 the conversion to type 
families made the compilation even slower.)



* Anonymous type function values

One of the most annoying type classes of the llvm package was the IsSized 
class:


  class (LLVM.IsType a, IsPositive size) = IsSized a size | a - size

where size is a type-level decimal natural number.

Many llvm functions require that an LLVM type has a size where the 
particular size is not important. However, I always have to name the size 
type. I also cannot get rid of it using a subclass, like


  class (IsSized a size) = IsAnonymouslySized a where

The 'size' type is somehow sticky.

The conversion of this type class to type families is straightforward:

  class (IsType a, PositiveT (SizeOf a)) = IsSized a where
 type SizeOf a :: *

Now I have to use SizeOf only if needed. I can also easily define 
sub-classes like


  class (IsSized a) = C a where


* No TypeSynonymInstances

At the right hand side of a 'type instance' I can use type synonyms like

  type instance F T = String

without the TypeSynonymInstance extension. This feels somehow more correct 
than refering to a type synonym in a class instance head like in


  instance C T String where

The compiler does not need to analyze String in order to find the correct 
instance.



* No FlexibleInstances

The same applies to

  instance C (T a) (A (B a))

which is a flexible instance that is not required for

  type instance F (T a) = A (B a)


* No MultiParamTypeClass, No UndecidableInstances

I have some type classes that convert a type to another type and a tuple 
of types to another tuple of types where the element types are converted 
accordingly. With functional dependencies:


  class MakeValueTuple haskellTuple llvmTuple | haskellTuple - llvmTuple where

  instance (MakeValueTuple ha la, MakeValueTuple hb lb) =
   MakeValueTuple (ha,hb) (la,lb)

The class is a multi-parameter type class and the instance is undecidable.

This is much simpler with type families:

  class MakeValueTuple haskellTuple where
type ValueTuple haskellTuple :: *

  instance (MakeValueTuple ha, MakeValueTuple hb) =
   MakeValueTuple (ha,hb) where
type ValueTuple (ha,hb) = (ValueTuple ha, ValueTuple hb)



Thus summarized: Type families may replace several other type extensions. 
If I ignore the associated type functions then many classes become Haskell 
98 with Haskell 98 instances. This is good because those instances prevent 
instance conflicts with other non-orphan instances.



== Disadvantage of TypeFamilies ==

* Redundant instance arguments

I have to write the type arguments both in the instance head and in the 
function argument. This is especially annoying in the presence of 
multi-parameter type classes with bidirectional dependencies. E.g.


class (a ~ Input parameter b, b ~ Output parameter a) = C parameter a b where
   type Input  parameter b :: *
   type Output parameter a :: *
   process :: Causal p (parameter, a) b

instance (...) = C (FilterParam a) v (FilterResult v) where
   type Input  (FilterParam a) (FilterResult v) = v
   type Output (FilterParam a) v = FilterResult v


With functional dependencies it was:

class C parameter a b | parameter a - b, parameter b - a where
   process :: Causal p (parameter, a) b

instance (...) = C (FilterParam a) v (FilterResult v) where


* Bidirectional dependencies

In GHC-6.12.3 it was not possible to write

  class (a ~ Back b, b ~ Forth a) = C a b where

Fortunately, this is now allowed in GHC-7. But bidirectional dependencies 
are still cumbersome to work with as shown in the example above.



* Equality constraints are not supported for newtype deriving

Not so important, just for completeness:
  http://hackage.haskell.org/trac/ghc/ticket/6088


== Confusions ==

* Upper case type function names

Why are type function names upper case, not lower case? They are not 
constructors after all. Maybe this is one reason, why I forget from time 
to time that type functions are not injective.


Sure, lower-case type variables are implicitly forall quantified in 
Haskell 98. In the presence of lower-case type functions we would need 
explicit forall quantification.


* Why can associated types not be exported by C(AssocType) syntax?

Why must they be exported independently from the associated class?


* FlexibleContexts

The context (Class (TypeFun a)) requires 

[Haskell-cafe] HaL-7, 2012-07-13, Call for submissions

2012-04-23 Thread Henning Thielemann


Call for submissions and Save the date

for our local Haskell Workshop in Halle/Saale, Germany.

Tutorials, talks, demonstrations ... everything welcome.

Workshop language is German (mainly), and English (by request).

Submission deadline: May, 21, Workshop date: July, 13



Workshop homepage: http://iba-cg.de/hal7.html


The complete call in German:

-

Aufruf zum Einreichen von Beiträgen
und Hinweis zum Vormerken des Termins

Was: Haskell-Treffen HaL-7
Wann: Freitag, 13.07.2012
Wo: Institut für Informatik an der Martin-Luther-Universität in Halle an
der Saale

Wir suchen Vorträge zu Haskell im Besonderen und der funktionalen
Programmierung im Allgemeinen, zum Beispiel zu den Themen

* Neues von Sprache, Bibliotheken, Werkzeugen,
* Anwendungen von Kunst bis Industrie,
* Lehre an Schulen und Hochschulen,

gerne aber auch zu anderen Themen.

Die Beiträge können präsentiert werden als

* Tutorium (60 .. 90 min)
* Vortrag (30 min)
* Demonstration, künstlerische Aufführung

Die Veranstaltungssprache ist Deutsch, in begründeten Ausnahmen
Englisch. Presentations will be given in German but we can switch to
English if requested.

Bitte reichen Sie Kurzfassungen der Beiträge ein (2 bis 4 Seiten), die
dem Programmkomitee eine Einschätzung ermöglichen. Die Kurzfassung soll
mit einer Zusammenfassung (10 Zeilen) beginnen und einem
Literaturverzeichnis enden.

Teilnehmer des Workshops sind Interessenten (keine Erfahrung mit
Haskell/FP), Anfänger (wenig Erfahrung) und Experten. Wir bitten die
Vortragenden, die Zielgruppe des Beitrags anzugeben und die nötigen
Vorkenntnisse zu beschreiben. Bei Tutorien sollen Teilnehmer auf eigenen
Rechnern arbeiten. Bitte beschreiben Sie dazu die vorher zu
installierende Software.

Schicken Sie Beitragsvorschläge als PDF-Dokument bis zum

21.05.2012

per Mail an hal-committee at iba-cg punkt de oder an ein Mitglied des
Programmkomitees.


Programmkomitee

* Henning Thielemann - Univ. Halle (Vorsitzender),

* Petra Hofstedt - BTU Cottbus,
* Alf Richter - iba CG Leipzig,
* Uwe Schmidt - FH Wedel,
* Janis Voigtländer - Univ. Bonn,
* Johannes Waldmann - HTWK Leipzig.



Mit besten Grüßen
Henning Thielemann

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: notcpp-0.0.1

2012-04-13 Thread Henning Thielemann


On Fri, 13 Apr 2012, Ben Millwood wrote:


But I never liked using CPP: it completely defeats haskell-src-exts
and hence things like SourceGraph, and anyway it's not designed for
Haskell and doesn't at all understand its structure, or fit with its
syntax. With a little thought, I wondered if creative use of template
haskell might not achieve the same goal. It turned out it did, and
emboldened with this knowledge I set out to write a new package making
this technique available to others.


I never liked CPP in Haskell, too. The problem is: I also do not like 
Template Haskell. :-) Whereever possible I use a Cabal flag and a 
conditional Hs-Source-Dirs.


http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Adapt_to_different_systems_without_CPP

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


Re: [Haskell-cafe] [Haskell] Higher types in contexts

2012-03-05 Thread Henning Thielemann


moved to haskell-cafe


On Mon, 5 Mar 2012, Barney Hilken wrote:


Is there any deep reason why I can't write a polymorphic type in a context? I 
think the record update problem can be (sort of) solved if you could write:

class Has r Rev (forall a. [a] - [a]) = HRClass r where
setHRClass :: (forall a.[a] - [a]) - r - r

but polymorphic types are not allowed in contexts. Is this one of the problems SPJ 
considers Hard or is it a feasible extension?


I don't know what you want to do, but you may wrap the (forall a. [a] - 
[a]) in an existential type:


data ListFunc = forall a. ListFunc ([a] - [a])

class Has r Rev ListFunc = HRClass r where
setHRClass :: ListFunc - r - r

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


Re: [Haskell-cafe] [Haskell] Support tools for development with Cabal and Darcs

2012-02-10 Thread Henning Thielemann


On Fri, 10 Feb 2012, Duncan Coutts wrote:


Would you mind giving me a breif explanation of the compiling
multiple local packages in the right order feature? I'd like to
understand what is missing in cabal-install in this respect.

Currently with cabal-install you can say:

cabal install ./a ./b ./c

and it will install the packages in those directories in the right
order. (It is also possible to list other install targets including
local and remote tarballs, and of course packages from hackage).


I believe that the first version of cabal-sort is older than this 
cabal-install feature. Nonetheless, cabal-sort can be used for other 
purposes, too. E.g. you can use plain Cabal installation, when 'cabal 
install' does not work due to problems in constraint solving. You can 
upload packages in topologically sorted order to Hackage, such that 
building on Hackage works correctly. Is this also done by cabal-install's 
upload command? You can also use cabal-sort for stepping into package 
directories and do some manual updates before installing.


However, I will add references to the new cabal-install features in the 
documentation of cabal-sort.


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


Re: [Haskell-cafe] [Haskell] Support tools for development with Cabal and Darcs

2012-02-10 Thread Henning Thielemann


On Fri, 10 Feb 2012, Duncan Coutts wrote:


I wonder if you have any suggestions for UI changes/improvements for
cabal-install for working with related sets of local packages
(something it's fairly weak on at the moment). Are there things in
cabal-sort you think we should just lift directly into cabal-install
or variations etc?


Sure, you can add a command 'sort' that outputs the given packages in 
topologically sorted order. :-)


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


Re: [Haskell-cafe] [Haskell] Support tools for development with Cabal and Darcs

2012-02-10 Thread Henning Thielemann


On Fri, 10 Feb 2012, Henning Thielemann wrote:


On Fri, 10 Feb 2012, Duncan Coutts wrote:


I wonder if you have any suggestions for UI changes/improvements for
cabal-install for working with related sets of local packages
(something it's fairly weak on at the moment). Are there things in
cabal-sort you think we should just lift directly into cabal-install
or variations etc?


Sure, you can add a command 'sort' that outputs the given packages in 
topologically sorted order. :-)


I missed something: The reason for the current upload was a new cabal-sort 
feature that emits the package dependencies as a Makefile in order to 
allow building packages in parallel using 'make -j'. Of course, a '--jobs' 
option would also be a nice addition to 'cabal install'.


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


Re: [Haskell-cafe] [Haskell] ANNOUNCE multiarg - parser combinators for command line parsing

2012-01-30 Thread Henning Thielemann


On Sun, 29 Jan 2012, Simon Meier wrote:


I'm currently using Neil Mitchell's cmdargs package [1]. How does your
package compare to that?


Last time I checked cmdargs it was not referential transparent. Is 
multiarg better in this respect?


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


[Haskell-cafe] black Wikipedia (Was: PhD program at Portland State accepting applications)

2012-01-18 Thread Henning Thielemann


On Wed, 18 Jan 2012, Nathan Collins wrote:


- Portland is a very popular US city, known for beer, bikes, music,
and street food:

http://en.wikipedia.org/wiki/Portland_Oregon (wikipedia is blacked out today)


Maybe it is only a JavaScript trick. In Firefox (with JavaScript) I see 
the complete a page before it is overwritten by the protest page. In 
Konqueror of KDE 3 (with and without JavaScript) I can read the Wiki pages 
without problems. Edit however is really disabled. Sometimes I am glad to 
have the old technology available. :-)



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


Re: [Haskell-cafe] black Wikipedia

2012-01-18 Thread Henning Thielemann


On Wed, 18 Jan 2012, Andrew Butterfield wrote:


Just add ?banner=none to the url if you really have to read the page


Maybe the intention was to demonstrate that censorship (in this case 
self-censorship) is mostly a problem for average users but not for 
advanced users.


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


[Haskell-cafe] compare lengths of lists lazily

2011-12-19 Thread Henning Thielemann


Shortest and most obfuscating solution I found is:


import Data.Ord (comparing)
import Control.Applicative (($))

compareLength :: [a] - [a] - Ordering
compareLength = comparing (()$)

:-)

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


Re: [Haskell-cafe] [Haskell] Dutch National FP Day 2012

2011-11-16 Thread Henning Thielemann


On Wed, 16 Nov 2011, Sean Leather wrote:


(Sent on behalf of Doaitse Swierstra)

Despite some last minute changes to the planning we are happy to announce that 
the next
Dutch functional programming day will take place on January 6, 2012, at the 
university
campus De Uithof of Utrecht University.

In case you want to give a presentation please send title, speaker and abstract 
to
doai...@swierstra.net before Dec 1.


What is the language of the talks and the participants? English or Dutch?

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


Re: [Haskell-cafe] [Haskell] ANN: global-variables-1.0

2011-10-12 Thread Henning Thielemann


On Wed, 12 Oct 2011, Jean-Marie Gaillourdet wrote:


* Simplify the configuration problem - at least for code in the
  IO monad.

Note, that this library does not encourage sloppy software design by
re-introducing all bad effects of global variables.


But isn't this kind of solution for the configuration problem an example 
for sloppy software design? If a global configuration would be passed 
around, then you could easily use the program functions with different 
configurations simultaneously. In contrast to that, with the global IORef 
this is not possible.


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


Re: [Haskell-cafe] fyi GHC 7.2.1 release on the benchmarks game

2011-08-12 Thread Henning Thielemann

On 12.08.2011 18:44, austin seipp wrote:

Hello Isaac,

On Fri, Aug 12, 2011 at 10:18 AM, Isaac Gouyigo...@yahoo.com  wrote:

1) Some of the GHC programs contributed to the benchmarks game have problems 
with recent GHC releases

- meteor-contest #5 - Ambiguous occurrence `permutations'

http://shootout.alioth.debian.org/u64q/program.php?test=meteorlang=ghcid=5#log


This can be fixed by changing the line:

import Data.List

to:

import Data.List hiding (permutations)


... and enabling the warning
  -fwarn-missing-import-lists
in order to be warned about such imports ...

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


Re: [Haskell-cafe] ANNOUNCE: yap-0.0 - yet another prelude

2011-08-11 Thread Henning Thielemann


On Thu, 11 Aug 2011, Sebastian Fischer wrote:


[switched to Cafe]

On Wed, Aug 10, 2011 at 11:46 PM, Henning Thielemann
lemm...@henning-thielemann.de wrote:


On Wed, 10 Aug 2011, Paterson, Ross wrote:


Yet another restructuring of the Prelude numeric classes on algebraic
lines, proposed for a revision of the Haskell Prelude:

http://hackage.haskell.org/package/yap-0.0


A nice lightweight design, both in terms of the use of type extensions and
import dependencies, that should people encourage to use it, when they are
afraid of changing to a more radical approach like numeric-prelude. I would
have prefered the name AdditiveGroup to AbelianGroup, since with '+' and '-'
and '0' I associate more than just the laws of an Abelian group. The
multiplicative group of rational numbers is abelian, too.


I'm curious: what laws do you have in mind for '+', '-', and '0' that
do not hold in the multiplicative group of rational numbers with

   (+) = (*); (-) = (/); 0 = 1

?


 I do not associate more laws, but I expect to use zero for things that 
are somehow related to numbers. And I also do not want to use (+) and (-), 
say, for rational numbers to mean (*) and (/). That's not an algebraical 
reason, but a matter of error prevention and expectations.
 It's the same reason, why I would not want to define an Ord instance for 
Complex numbers. Complex numbers can be ordered, but a  (b::Complex 
Rational) will be a mistake in many cases, I guess.


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


Re: [Haskell-cafe] How to use cabal macros in .hsc files

2011-08-11 Thread Henning Thielemann

On 08.08.2011 12:08, Bas van Dijk wrote:

Hello,

Currently it's not possible to use cabal macros like
MIN_VERSION_base(x,y,z) in .hsc files:

http://hackage.haskell.org/trac/hackage/ticket/870

Is there a workaround to get the same effect?


Writing a plain Haskell module that contains the code that depends on 
the particular base-version?


Usually I try to stay away from this preprocessor hackery, and this case 
seems to support my attempts. What I do is to add Hs-Source-Dirs 
depending on some Cabal flag, and connect it with a field like 
Build-Depends: base==3.*.


http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Adapt_to_different_systems_without_CPP


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


Re: [Haskell-cafe] Help understanding Haskell runtime costs

2011-08-11 Thread Henning Thielemann

On 09.08.2011 01:43, Thiago Negri wrote:

Hello all,

I'm relatively new to Haskell and trying to solve some online judge's
problems in it.
One of the problems is to say if a given sentence is a tautogram or not.
A tautogram is just a sentence with all the words starting with the same letter.

My first try (solution is ok) was to do it as haskeller as possible,
trying to overcome my imperative mind.
But it did bad at performance (0.30 secs of runtime, 4.6 mb of memory):

-- code start
import Data.Char (toLower)

main = getContents=  mapM_ (putStrLn . toStr . isTautogram . words)
. takeWhile (/= *) . lines


That's still imperative! :-)

How about 'interact' and using 'unlines' instead of 'putStrLn' ?



toStr :: Bool -  [Char]


You may want to write String instead of [Char] for clarity.


toStr True = Y
toStr False = N

isTautogram :: [[Char]] -  Bool
isTautogram (x:[]) = True


I assume this case is not necessary, since  all [] == True  anyway.


isTautogram (x:xs) = all ((== firstChar) . toLower . head) xs
 where firstChar = toLower . head $ x


It is maybe more elegant, not to compare all words with the first one, 
but to compare adjacent words in the list:


all (zipWith (...) xs (drop 1 xs))



Note that the only thing that changed between the two tries was the main-loop.
The second version runs faster (got 0.11 secs) and with less memory (3.6 mb)

Can someone explain to me what is really going on?
Maybe pointing out how I can achieve these optimizations using
profiling information...


Interesting observation. I do not see a problem quickly.

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: GHC version 7.2.1

2011-08-11 Thread Henning Thielemann

On 09.08.2011 22:01, Ian Lynagh wrote:


The GHC Team is pleased to announce a new major release of GHC, 7.2.1.

The 7.2 branch is intended to be more of a technology preview than
normal GHC stable branches; in particular, it supports a significantly
improved version of DPH, as well as new features such as compiler
plugins and safe Haskell. The design of these new features may evolve
as we get more experience with them. See the release notes for more
details of what's new and what's changed.


These sound like a lot of exciting news. The release notes also mention 
a VECTORISE pragma, that is not mentioned in

   http://www.haskell.org/ghc/docs/7.2.1/html/users_guide/pragmas.html
and not in the index. Is it about the planned GHC support for 
SSE/AltiVec vector units or is it about DPH?


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


Re: [Haskell-cafe] Github support for cabal files

2011-08-08 Thread Henning Thielemann

On 24.07.2011 13:11, Joris Putcuyps wrote:

On Sat, 23 Jul 2011 19:25:53 -0700
Greg Weberg...@gregweber.info  wrote:



[1] http://hackage.haskell.org/package/hamlet


The cabal file should be compact, and quite often the
description field is very lengthy.
I would like it alot if I could reference a README.??? (pandoc
compatible extension) from cabal. Then it would be compatible with
github and give me more information in my haddock html pages which
were generated by `cabal haddock`.


To this end I sometimes wrote a dummy module containing more 
documentation. In the Cabal description file I refer to this module with 
a quotation like Module. This way, I can even organize the 
documentation in chapters. I added DEPRECATED pragmas to these modules, 
in order to prevent people from importing them.


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


Re: [Haskell-cafe] For class Monoid; better names than mempty mappend might have been: mid (mident) mbinop

2011-08-08 Thread Henning Thielemann

On 24.07.2011 22:20, Antoine Latter wrote:

On Sat, Jul 23, 2011 at 1:41 PM, KCkc1...@gmail.com  wrote:

It would be easier for beginners to grok.



I think that assumes that all beginners have a strong foundation in
algebra. Although it does have the advantage that the names are as
abstract as the class.


As pointed out earlier in this list, the name of the class and the 
methods are inconsistent. Monoid refers to a general algebraic 
structure, whereas mempty and mappend refer to certain instances like lists.


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


Re: [Haskell-cafe] difference between class context and deriving

2011-08-02 Thread Henning Thielemann


On Tue, 2 Aug 2011, Patrick Browne wrote:


What is the difference between using a class context and deriving in
data type declaration?
Are there certain situations in which one or the other is preferred?

data Eq a = Set1 a = NilSet1 | ConsSet1 a (Set1 a)


Note that these contexts might get removed from the language:
   http://hackage.haskell.org/trac/haskell-prime/wiki/NoDatatypeContexts

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


Re: [Haskell-cafe] A language that runs on the JVM or .NET has the advantage of Oracle Microsoft making those layers more parallelizable.

2011-07-30 Thread Henning Thielemann


On Sat, 30 Jul 2011, KC wrote:


Are there plans a foot (or under fingers) to make a version of Haskell
that runs on the JVM?


http://www.haskell.org/haskellwiki/GHC:FAQ#Why_isn.27t_GHC_available_for_.NET_or_on_the_JVM.3F

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


Re: [Haskell-cafe] Properties for Foldable

2011-07-29 Thread Henning Thielemann


On Fri, 29 Jul 2011, Conal Elliott wrote:


Is there a collection of laws associated with the Foldable class? Or for 
Traversable?  - Conal


Recently I asked the same question:
  http://www.haskell.org/pipermail/libraries/2011-June/016429.html

and got the answer:
  http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf

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


Re: [Haskell-cafe] Binding of an integer variable

2011-07-28 Thread Henning Thielemann


On Thu, 28 Jul 2011, Paul Reiners wrote:


I have a question about the following GHCi interaction:

Prelude let x = 23
Prelude :show bindings
x :: Integer = _

What is the meaning of the underscore in the third line?  Why doesn't it say 
this, instead?

x :: Integer = 23


I have never used ':show bindings' before ... in other cases like
   let x='a'
and
   let x=23::Int
 the value of 'x' is shown. If 'x' is bound to a function, the underscore 
is shown. Thus I assume, that ':show bindings' uses the underscore for 
types without text representation. But it seems not to use the 'Show' 
class, since in this case Integers could be shown.


The documentation does not mention the output of values, at all:
  http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/ghci-commands.html

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


Re: [Haskell-cafe] Binding of an integer variable

2011-07-28 Thread Henning Thielemann


On Thu, 28 Jul 2011, Brandon Allbery wrote:


On Thu, Jul 28, 2011 at 14:52, Henning Thielemann 
lemm...@henning-thielemann.de wrote:
I have never used ':show bindings' before ... in other cases like
  let x='a'
and
  let x=23::Int


Since you gave explicit types, x is bound to strict values directly; it's only 
when no type is given that GHCi needs to translate
the constant per the Language Report to an invocation of fromInteger.


let x=23::Integer

is left unevaluated, too. I do not understand, how fromInteger may change 
the state of evaluation.


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


Re: [Haskell-cafe] Approximate String Matching

2011-07-27 Thread Henning Thielemann


On Wed, 27 Jul 2011, dokondr wrote:


Hi,
I am looking for Haskell libraries to do approximate string matching:
http://en.wikipedia.org/wiki/Approximate_string_matching
I need this to reduce a set of English word variants with spelling errors to a 
single canonical dictionary entry.
Any libraries to work with spelling will also help.


In a quick investigation I found:
   http://hackage.haskell.org/package/edit-distance

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


Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Henning Thielemann


On Mon, 25 Jul 2011, Manfred Lotz wrote:


Hi there,
If I take example imap.hs


import System.IO
import Network.HaskellNet.IMAP
import Text.Mime
import qualified Data.ByteString.Char8 as BS
import Control.Monad

-- the next lines were changed to fit to my local imap server
imapServer = imap.mail.org
user = 
pass = 

main = do
 con - connectIMAP imapServer
 login con user pass
 mboxes - list con
 mapM print mboxes


This should be mapM_ and 'ghc -Wall' spots this problem since 6.12.


 select con INBOX
 msgs - search con [ALLs]
 mapM_ (\x - print x) (take 4 msgs)
 forM_ (take 4msgs) (\x - fetch con x = print)


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


Re: [Haskell-cafe] Idiomatic ways to make all instances of a certain class also instances of another?

2011-07-26 Thread Henning Thielemann


On Tue, 26 Jul 2011, Tim Cowlishaw wrote:


For instance, for a typeclass representing the interface that any
Order type should implement:

class Order o where
 price :: o - Int
 size :: o - Int

I'd like to be able to specify an Eq instance for all types of class
Order in a manner similar to this:

instance (Order o) = Eq o where
 o1 == o2 = (price o1 == price o2)  (size o1 == size o2)


You may define once:

orderEq :: Order o = o - o - Bool
orderEq o1 o2 = (price o1 == price o2)  (size o1 == size o2)

and then define instances like

instance Order A where ...
instance Eq A where (==) = orderEq

instance Order B where ...
instance Eq B where (==) = orderEq


I don't think there is an easier and still predictable way of defining the 
Eq instances.


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


Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Henning Thielemann


On Tue, 26 Jul 2011, Alexander Solla wrote:


Given two (IntMap Double)s a and b, I would compute the projection of a along b 
as

cosineSimilarity :: IntMap Double - IntMap Double - Double
cosineSimilarity a b  = (dot a b) / ((norm a) * (norm b)) where
                 dot  = sum . elems . intersectionWith (*)
                 norm = (**0.5) . sum . fmap (**2) . elems


Never write (**2) and (**0.5)! Use (^2) and sqrt!

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

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


Re: [Haskell-cafe] Library for Sparse Vectors?

2011-07-26 Thread Henning Thielemann


On Wed, 27 Jul 2011, dokondr wrote:


In your example:
1)  I would use:

   dot = dot' * dot'
   dot'  = sum . elems . intersectionWith (*)
   norm = sum . fmap (**2) . elems
 instead of:

dot  = sum . elems . intersectionWith (*)
norm = (**0.5) . sum . fmap (**2) . elems
2)  I don't understand the syntax:
cosineSimilarity $ lookup x space                  * lookup y space     

What are $ and *?


They are from Control.Applicative and are applied to a Maybe type here. It 
means that cosineSimilarity is applied to the result of looking up 'x' and 
'y' in space. If 'x' or 'y' is not in space, then

  cosineSimilarity $ lookup x space * lookup y space
 is Nothing.

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


Re: [Haskell-cafe] Stack space overflow in HaskellNet

2011-07-26 Thread Henning Thielemann


On Tue, 26 Jul 2011, Manfred Lotz wrote:


main = do

s   con - connectIMAP imapServer

 login con user pass
 mboxes - list con
 mapM print mboxes


This should be mapM_ and 'ghc -Wall' spots this problem since 6.12.


The compiler (7.04) doesn't tell me anything about it.


It seems that it is no longer part of -Wall. But since this mistake is 
very common, I think it would be better. Problem is, that several 
libraries like parser libraries are designed for silently throwing away 
results.


You have to switch on -fwarn-unused-do-bind, according to
  
http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/options-sanity.html

Also in case this does not fix your stack space overflow, (mapM_ print) is 
the correct (space-efficient) way.



I'm not quite sure I understand what you mean. Stack overflow comes
from this:
   forM_ msgs (\x - fetch con x = print)

If I change it to:
   mapM_  (\x - fetch con x = print) msgs

there is the same stack overflow.


forM_ and mapM_ are equal in this respect, the underscore is important.

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


Re: [Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Henning Thielemann


On Wed, 20 Jul 2011, Комар Максим wrote:


I want to install package NetSNMP:

cabal install NetSNMP

Resolving dependencies...
Configuring NetSNMP-0.1.6...
cabal: Missing dependency on a foreign library:
* Missing C library: netsnmp
This problem can usually be solved by installing the system package that
provides this library (you may need the -dev version). If the library
is already installed but in a non-standard location then you can use
the flags --extra-include-dirs= and --extra-lib-dirs= to specify where
it is. cabal: Error: some packages failed to install:
NetSNMP-0.1.6 failed during the configure step. The exception was:
ExitFailure 1

Package net-mgmt/net-snmp already installed:

pkg_info | grep snmp

net-snmp-5.5_4  An extendable SNMP implementation


As Cabal tells, the developer files are needed, too, and are usually found 
in packages ending on '-dev' or '-devel', that is, in your case 
net-snmp-dev.


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


Re: [Haskell-cafe] haskell zlip read position

2011-07-20 Thread Henning Thielemann


On Wed, 20 Jul 2011, rahul wrote:


Hi Guys,
   I am trying to parse a binary stream with the format for one entry
[headers, zlib compressed content] , with multiple entries.
I can use the Zlib library to get the content for the first entry after
the headers, but I cannot find a way to get the offset to start parsing
for the second entry.  Is there a way I can get this information out of
ZLib? or is there a better approach to doing this? Any pointers would be
very much appreciated.


As far as I know, these are compressors for single files. Multiple files 
can be compressed in connection with TAR, that can be manipulated from 
Haskell using the 'tar' package.


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


Re: [Haskell-cafe] NetSNMP; FreeBSD 8.1

2011-07-20 Thread Henning Thielemann


On Wed, 20 Jul 2011, Brandon Allbery wrote:


Ports is build-from-source, so every package is what Linux calls a -dev package.

The OP might need to make sure that cabal knows to look in /usr/local for 
libraries.


I see. If net-snmp supports pkg-config then all such problems should be 
solvable by using the pkg-config support of Cabal. So you might run


$ pkg-config --list-all

on your machine, see whether net-smnp is listed, and if yes, encourage the 
author of NetSNMP bindings to use the PkgConfig field in his Cabal package 
description.


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


Re: [Haskell-cafe] Parsing cabal files to calculate average number of dependencies

2011-07-19 Thread Henning Thielemann

On 02.07.2011 01:26, Gwern Branwen wrote:


Another thing you can do along the same lines is generate a script to
download all the repos from packages which declare repos. Some ugly
code:


If 'script' also includes Haskell code, then the 'tar' package could be 
of help to walk throught the TAR archive.


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


[Haskell-cafe] Compiler support for orphan instances

2011-07-14 Thread Henning Thielemann


Yesterday I tried to install fix-imports and ran into another example of 
problems with changing transitive closures of orphan instance propagation:


$ cabal install fix-imports
Resolving dependencies...
Configuring fix-imports-0.1.2...
Preprocessing executables for fix-imports-0.1.2...
Building fix-imports-0.1.2...
[1 of 6] Compiling Types( src/Types.hs, 
dist/build/FixImports/FixImports-tmp/Types.o )
[2 of 6] Compiling Util ( src/Util.hs, 
dist/build/FixImports/FixImports-tmp/Util.o )
[3 of 6] Compiling Index( src/Index.hs, 
dist/build/FixImports/FixImports-tmp/Index.o )


src/Index.hs:48:15:
No instance for (Monad (Either [Char]))
  arising from a use of `sequence' at src/Index.hs:48:15-40
Possible fix:
  add an instance declaration for (Monad (Either [Char]))
...


It is a repeating problem that you use an instance without noting it (here 
Monad (Either [Char])) and import it without noting it (you import a 
module, that possibly by accident imported and thus re-exported that 
instance). If the modules you import, decide to no longer use the Monad 
Either instance, then your imports will ignore the instance.


I thought that some compiler support could reduce this problem.


Proposal 1

GHC might warn, if you use an orphan instance but import it from a module, 
that does not define it.


Example:

module A where

instance Msg s = Monad (Either s) ...


module B where

import A


module C where

{-
B does not define instance Monad Either,
but propagates that instance from A.
-}
import B

test :: Either String Int
test = do
   fail bla
   return 5
{-
Here GHC should emit a warning,
since the Monad Either instance is imported from B
but not directly from A.
If B drops the 'import A' this will no longer work.
-}


Proposal 2

Sometimes a module is actually intended for re-exporting an instance. 
Sometimes an instance is moved from module A to module Z, but A still 
re-exports the instance in order to maintain compatibility. In these cases 
proposal 1 would yield false alarms. So maybe there should be a pragma for 
tagging instances that are intentionally re-exported. Problem: How to 
identify instances? This is certainly related to earlier ideas of explicit 
named instance imports.


module A where

instance Msg s = Monad (Either s) ...


module B where

import A
{-
Explicitly propagate the instance from A,
which is as good as defining it here.
If the instance is not in scope,
then compilation should fail at this pragma.
This way it is asserted, that the instance is really exported.
-}
{-# INSTANCE-EXPORT Monad (Either s) #-}


module C where

import B

test :: Either String Int
test = do
   fail bla
   return 5
{-
No warning here, because B intentionally propagated the Monad Either 
instance.

-}


Proposal 3

Forget about all those proposals and implement named instances. However 
the proposals 1 and 2 let you write code that works on all Haskell 98 
compilers. Compilers may just not warn or ignore the INSTANCE-EXPORT 
pragma. Proposal 3 requires a language extension and using it will work 
only on the compilers that support that extension.



Proposal 4

Forget about flexible, undecidable, overlapping, orphan and other 
instances and create a system, where classes are replaced by explicit 
method dictionaries and some rules for inserting these dictionaries, where 
the rules can be declared by the package author in the modules.


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


Re: [Haskell-cafe] ANN: fix-imports-0.1.2

2011-07-13 Thread Henning Thielemann

On 12.07.2011 09:59, Evan Laforge wrote:

I meant more in the Before: ... After: ... sense ;-) (i.e. visually
being able to tell what your program does, rather than just a
description).


Oh, ok, I guess I can do that too:

Before:

module M where
import ZZ.Out.Of.Order
import qualified No.Longer.Needed as Needed

-- x = Needed.y -- just removed this
y = New.something -- just added this

After:

module M where
import qualified Heavily.Nested.New as New
import ZZ.Out.Of.Order

-- x = Needed.y -- just removed this
y = New.something -- just added this



I also spend some time on managing imports. I'll try this program. 
However, usually I have a mix of qualified and unqualified imports, 
since some libraries are designed for unqualified imports.


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


Re: [Haskell-cafe] Inconsistent trailing comma in export list and record syntax

2011-07-11 Thread Henning Thielemann


On Mon, 11 Jul 2011, Johan Tibell wrote:


On Mon, Jul 11, 2011 at 3:54 PM, Henning Thielemann
thunderb...@henning-thielemann.de wrote:

Johan Tibell wrote:

I've found this quite annoying, especially when using CPP to
conditionally include something in a list, as it might force you to
reorder the list to make the commas appear correctly when the
conditional section is enabled/disabled.


In this case I use the colon like a terminator.

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


Sorry, I wasn't being clear. I meant for import/export lists.


But in import/export lists you can use the trailing comma, and thus you 
can conditionally export or import identifiers at any position. However, 
the trailing comma is forbidden in enumerations of constructors. E.g.


import M (R, S, T, )

is allowed, but not

import M (T(A,B,C,))

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


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-10 Thread Henning Thielemann


On Sun, 10 Jul 2011, Felipe Almeida Lessa wrote:


On Sat, Jul 9, 2011 at 7:58 AM, Henning Thielemann
lemm...@henning-thielemann.de wrote:

My stream processors are not Arrows, because 'first' cannot be implemented.
However, 'arr' and '.' can be implemented.

...

Since I have no Arrow instance I even have to write my own combinators that
are counterparts to () and friends.


If you have arr, (.) and (), then you have first as well:

 f  g = (arr fst  f)  (arr snd  g)

 first' f = f  arr id

Am I missing something here? =)


I have only something like (), but not precisely ().

I have for instance

parallel :: (Monoid b) = T a b - T a b - T a b

The arrow (T a b) emits a value of type 'b' for every incoming event of 
type 'a', but may also emit a 'b' without any input trigger. 
Monoid.mappend is used to merge the events if both input arrows generate 
an output at the same time.


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


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-10 Thread Henning Thielemann


On Sun, 10 Jul 2011, Heinrich Apfelmus wrote:

Question: how would you actually like to describe the guitar simulator at a 
high-level? Did you already wish for some specific combinators? Assume that 
you had something like reactive-banana available and imagine that there were 
a benevolent djinn granting you three new primitive combinators of your 
choice.


If I would know of appropriate combinators, I would just implement them 
and not ask the djinn. :-)


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


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-09 Thread Henning Thielemann


On Sat, 9 Jul 2011, Heinrich Apfelmus wrote:

Oh, I am addressed explicitly, thanks! Yes, GUI for 'streamed' would be 
nice, too.
In the meantime I switched from an approach with lazy lists to one with 
arrow-like stream processors. This way I could resolve all issues with 
wrong timing and inappropriate waiting, but now code looks more low-level. 
There are some examples lying around, that I even not started to implement, 
because I expect that implementing them in the current low-level way will 
yield nasty bugs. Thus I am highly interested in more sophisticated MIDI 
stream editor combinators. I expect that inspiration from other FRP 
frameworks would help me.


Of course, my intention was that you throw away your stream processors and 
use reactive-banana for everything. ;D  I have made sure that it can be used 
both for real-time and for offline computations.


Could you expand a little on your arrow-like stream processors? What do the 
arrows look like,


   data SF a b = SF (a - (b, SF a b))

?


My stream processors are not Arrows, because 'first' cannot be 
implemented. However, 'arr' and '.' can be implemented.


As far as I understand, the SF banana can only produce an output if an 
input event arrives. But my stream processor can set alarms in order to 
produce a clock signal. This way they can generate output without any 
input.


Currently my stream processors are defined using an explicit state, that 
is hidden using an existential quantifier, but of course I would prefer a 
Haskell 98 solution.


For example, an arpeggiator stream processor consists of two 
functions:

 1. Receive key up/down events and keep track of the currently pressed keys.
 2. Receive a MIDI controller that controls the tempo of the arpeggiator.
The stream processor sets the alarm according the current tempo
and at every alarm event it sends a single key
chosen from the set of the currently pressed keys.

This example shows, that a stream processor cannot support Arrow.first, 
that is extending (arrow a b) to (arrow (a,c) (b,c)), since for an alarm 
event, we have no input of type c that could be passed through.


Currently I have build the two tasks into one stream processor. I would 
like to split these into two processors. This looks difficult to me, since 
the first stream processor (for management of pressed keys) must provide a 
state (the set of pressed keys) whenever the second stream processor (for 
clock generation) needs it.



Which additional primitives did you include, for instance

   switch :: SF in (out, Maybe t) - (t - SF in out) - SF in out
   delay  :: Time - SF a b - SF a b

?


Since I have no Arrow instance I even have to write my own combinators 
that are counterparts to () and friends.


And of course, I am particularly interested in the nasty examples that you 
came up with. :)


For example I want to write a Guitar simulator: You press a set of keys 
together and the processor converts this into successive tones on a 
guitar.
  Technically I like to do it this way: When a key is pressed, collect all 
key press events in the following 10ms. After this period emit all pressed 
keys according to a certain pattern. When one of the pressed keys is 
released, then send key-press(!) events for all currently pressed keys 
according to another pattern. Repeat this cycle. Manage somehow the keys 
that are pressed after the first key-down-collecting phase and the keys 
that are released during this initial phase. Ignore them or do something 
more sensible about them, but make sure that in the output all key-down 
events are eventually matched with a key-up event and that for the same 
key you never send two successive key-down events or two successive key-up 
events. That is, for the same key, key-up and key-down events must 
alternate. An exception might be if you receive bogus input. But even 
then, the number of key-up and key-down events for one note in the output 
shall match, whenever this is true for the input.


 For lazy lists you can do time related processing by splitting the list 
of events and process the prefix differently from the suffix and then 
concatenate the results. This is easy and declarative, but you have no 
guarantee that the resulting stream processing is causal and that the 
timing is correct. (The second problem arises when merging two event 
lists. Merging implies that when waiting for two events then actually the 
system waits for the later of the events, but we need to wait for the 
first of the two events.)


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


Re: [Haskell-cafe] Call for GUI examples - Functional Reactive Programming

2011-07-08 Thread Henning Thielemann


On Fri, 8 Jul 2011, Heinrich Apfelmus wrote:

Can GUI programming be liberated from the IO monad? Functional Reactive 
Programming (FRP) promises as much, and I'm trying to make this dream a 
reality with my [reactive-banana][] library. Having released version 
0.4.0.0, I am now looking for example programs to direct the future 
evolution of the library.


This is the request that I was waiting for. :-)

I have some very small wxwidgets example programs that send and receive 
MIDI messages via ALSA in order to map, e.g. sliders to MIDI controller 
knobs. I must synchronize the value of a slider with a spin widget and 
incoming and outgoing MIDI messages and found the way to connect them very 
low-level. I would like to see this in a more declarative style.


http://hackage.haskell.org/package/alsa-gui



* I think that Tim Docker's minimal step sequencer [hbeat][] simply makes a 
great example. I hope that wxHaskell offers a platform-independent way to 
play sound.


I think there are some ways for playing sounds in a portable way, like 
'jack' or PortAudio.


* Notes of a musical performance can be modeled as event streams (MIDI), as 
Henning Thielemann has [done with great effect][midi streams]. Surely, 
reactive-banana should be up to the task, but writing an arpeggiator seems 
impossible at the moment.


Oh, I am addressed explicitly, thanks! Yes, GUI for 'streamed' would be 
nice, too. In the meantime I switched from an approach with lazy lists to 
one with arrow-like stream processors. This way I could resolve all issues 
with wrong timing and inappropriate waiting, but now code looks more 
low-level. There are some examples lying around, that I even not started 
to implement, because I expect that implementing them in the current 
low-level way will yield nasty bugs. Thus I am highly interested in more 
sophisticated MIDI stream editor combinators. I expect that inspiration 
from other FRP frameworks would help me.


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


Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann


On Wed, 6 Jul 2011, Ian Childs wrote:

Suppose I have two terms s and t of type a and b respectively, and I want 
to write a function that returns s applied to t if a is an arrow type of 
form b - c, and nothing otherwise. How do i convince the compiler to 
accept the functional application only in the correct instance?


Why can't 's' simply have type 'b - c'? With term do you mean a Haskell 
expression?


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


Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann


On Wed, 6 Jul 2011, Ian Childs wrote:

Yes they are Haskell expressions - I called them terms because actually they 
are GADTs of type Term a and Term b. I can't use type 'b - c' as they are 
part of a larger pattern.


I have a function that returns a witness to 's :: Term a' and 't :: Term b' 
having the same type, if they do, but I am wondering how to extend this to 
the first argument of an arrow type.


Can you give us a bit more (but not too much) code in order to show the 
problem?


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


Re: [Haskell-cafe] function terms

2011-07-06 Thread Henning Thielemann


On Wed, 6 Jul 2011, Ian Childs wrote:

Term a is meant to be the simply-typed lambda-calculus as a GADT. Then given 
two terms App (App = l1) r1, and App (App = l2) r2, I want to form App 
(App = (App l1 l2)) (App r1 r2), but as you can see this will only work if 
the types of l1 and l2, and r1 and r2, match as detailed previously. does 
that make sense?


What is App? It looks like you apply it once to a string (=) and also to 
terms(?) like l1, r1. How is the GADT defined?


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


Re: [Haskell-cafe] ~ type operator

2011-07-02 Thread Henning Thielemann

On 24.06.2011 11:10, Daniel Fischer wrote:

On Friday 24 June 2011, 10:26:42, Guy wrote:

What does the ~ type operator mean? I've sometimes seen types such as (a
~ b) in error messages, but can't understand what GHC is trying to tell
me.


Type equality, (a ~ b) means that a and b are the same type (rather, that
the compiler can prove they're the same).


This type operator is needed when using type families. With functional 
dependencies you can assert a bijection between types by writing


class C a b | a - b, b - a where

but using type functions you have to tell the compiler somehow that one 
type function reverses the mapping of another function. This is where 
(~) is needed. You can use this type operator, when LANGUAGE 
TypeFamilies is enabled.


I assume that the use of (~) in type error messages reflects that GHC's 
type checker is now internally based on type families. There are also 
other circumstances, where GHC uses non-Haskell-98 syntax in its 
messages, e.g. it uses explicit 'forall' quantifiers in error messages 
also if they are disabled in the affected module.


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


Re: [Haskell-cafe] Period of a sequence

2011-07-02 Thread Henning Thielemann

On 26.06.2011 16:16, michael rice wrote:

MathWorks has the function seqperiod(x) to return the period of sequence
x. Is there an equivalent function in Haskell?


seqperiod x = fst $ head $ filter (flip List.isPrefixOf x . snd) $ tail 
$ zip [0..] $ List.tails x


This relies on the fact, that p is a period of x, if
  isPrefixOf (drop p x) x
.

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


Re: [Haskell-cafe] Printing the empty list.

2011-07-02 Thread Henning Thielemann

On 01.07.2011 00:58, Joshua Ball wrote:

GHCi seems to be clever about some things:

If I try to print the empty list in ghci, I encounter no problems:

Prelude  []
[]
Prelude  show []
[]
Prelude  print []
[]

Even though the type of the list is clearly unknown, it must be
picking SOME type. (why does it print [] instead of )?

If I write a program in a file and load it in

main = print []

Then I get the ambiguous type variable error that I would expect. Why
doesn't ghci generate this error at the prompt?


GHCi will warn you, that type defaulting was used, if you start it with

ghci -Wall


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


Re: [Haskell-cafe] commutative monoid?

2011-06-25 Thread Henning Thielemann


On Fri, 24 Jun 2011, Evan Laforge wrote:


So there's a range of possible Monoid instances for each type, and
maybe they were chosen by historical happenstance rather than some
kind of principle monoid (is there such a thing?).  Is there a name
for the thing that's like a monoid, but the operator is commutative
too?


http://en.wikipedia.org/wiki/Commutative_monoid

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


Re: [Haskell-cafe] None brute-force BWT algorithm

2011-06-24 Thread Henning Thielemann


On Thu, 23 Jun 2011, larry.liuxinyu wrote:


I think that version is still a brute-force solution. The only difference is 
that it uses EOF (sentinel) so that it can sort the
suffixes instead of rotations.
However, the big-O complexity is the same.

Let's take the rbwt for example:

 rbwt xs = let
 res = sortBy (\(a:as) (b:bs) - a `compare` b) (zipWith' (:) xs res)
   in
 tail . map snd . zip xs $ head res
Here we can see that, although the infinity res is lazy-evaluated, it actually 
sorts the matrix N times, adding one column per
evaluation.


Did you also compare the actual runtimes? As far as I understand, the 
matrix in Bertram's code is sorted once. Sharing of data avoids 
recomputation.


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


Re: [Haskell-cafe] None brute-force BWT algorithm

2011-06-23 Thread Henning Thielemann


On Wed, 22 Jun 2011, larry.liuxinyu wrote:


Hi,

I read a previous thread about BWT implementation in Haskell:
http://www.mail-archive.com/haskell-cafe@haskell.org/msg25609.html
and
http://sambangu.blogspot.com/2007/01/burrows-wheeler-transform-in-haskell

They are all in a `brute-force' way, that is implement based on 
Burrows-Wheeler's definition like below:


I thought that the knot-tying solution by Bertram Felgenhauer in the same 
thread was both elegant and efficient:

  http://www.mail-archive.com/haskell-cafe%40haskell.org/msg25692.html

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


Re: [Haskell-cafe] Simple CSV parser?

2011-06-16 Thread Henning Thielemann


On Thu, 16 Jun 2011, Daniel Patterson wrote:


Do any of the ones on hackage work for you?
http://hackage.haskell.org/package/csv-0.1.2

http://hackage.haskell.org/package/bytestring-csv

http://hackage.haskell.org/package/csv-enumerator

(note: hackage supports search via google it works reasonably well)


How could it miss my lovely package named spreadsheet? It provides a 
lazy parser.


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


Re: [Haskell-cafe] Simple CSV parser?

2011-06-16 Thread Henning Thielemann


On Fri, 17 Jun 2011, Dmitri O.Kondratiev wrote:


How to make cabal install all the dependencies? I couldn't find this in the 
docs at:
http://www.haskell.org/haskellwiki/Cabal-Install


Usually, 'cabal install' automatically installs all imported packages. But 
it will certainly not do, if a dependency problem cannot be solved by 
downloading packages. In your case it may be, that installed packages are 
compiled with respect to different versions of the same package, say 
'transformers'.


I found out, that you get more useful cabal messages if you force 
cabal-install to use a specific version of a package.


Say, run
$ ghc-pkg list transformers
transformers-0.2.2.0

Then call
$ cabal install spreadsheet --constraint=transformers==0.2.2.0

What does 'cabal' tell you?

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


Re: [Haskell-cafe] Simple CSV parser?

2011-06-16 Thread Henning Thielemann


On Fri, 17 Jun 2011, Dmitri O.Kondratiev wrote:


cabal install spreadsheet --constraint=transformers==0.2.2.0
Resolving dependencies...
cabal: cannot configure spreadsheet-0.1. It requires transformers ==0.0.*
For the dependency on transformers ==0.0.* there are these packages:
transformers-0.0.0.0 and transformers-0.0.1.0. However none of them are
available.
transformers-0.0.0.0 was excluded because of the top level dependency
transformers ==0.2.2.0
transformers-0.0.1.0 was excluded because of the top level dependency
transformers ==0.2.2.0


I see. I had fixed the problem locally long time ago, but somehow missed 
upload to Hackage. Try the updated package, please.


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


Re: [Haskell-cafe] Simple CSV parser?

2011-06-16 Thread Henning Thielemann


On Thu, 16 Jun 2011, Felipe Almeida Lessa wrote:


[1] http://hackage.haskell.org/package/bytestring-csv
[2] http://hackage.haskell.org/package/csv-enumerator
[3] http://hackage.haskell.org/package/spreadsheet
[4] http://hackage.haskell.org/package/csv
[5] http://hackage.haskell.org/package/ssv


I have updated
  http://www.haskell.org/haskellwiki/Spreadsheet


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


Re: [Haskell-cafe] Best platform for development with GHC?

2011-06-14 Thread Henning Thielemann


On Wed, 15 Jun 2011, Dmitri O.Kondratiev wrote:


Which platform - Mac OS X, Linux or Win32 is best for development with GHC 
today?
How are things with Ubuntu? It was quite a while already that I used Haskell on 
Linux. Today I have to code on Win32  and Mac OS
X. Installing extra libraries caused most of the pains for me on Win32 - for 
example GTK and Gnuplot is not easy to install on
Win32. Installing GTK on Max OSX is also a hard work, but no problems with 
Gnuplot at all. Haskell mode for Emacs works fine on
Mac OS X, but only to some extent on Win32. I have not managed to start GHCi in 
Emacs buffer on Win32.


Since I maintain the gnuplot binding for Haskell - what are the particular 
problems with that package on Windows?



I understand that Linux should be a much better environment for integrating 
with external libraries (just because most of them
were originally developed for Linux).


I use GHC and GHCi on Linux/KDE. Most editors and text viewers know about 
Haskell and provide syntax highlighting. E.g. if I watch a Haskell module 
in a remote darcs repository with KDE's browser Konqueror, then the text 
is shown with highlighted syntax. It is very helpful, to recognize 
outcommented parts of code quickly. If I edit, I see immediately whether 
comments are closed appropriately.


I once used GHCi on Windows, but I didn't like it, because the Windows 
command line was no fun to use.


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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: Parallel and Concurrent programming in Haskell, a tutorial

2011-06-13 Thread Henning Thielemann


On Thu, 19 May 2011, Simon Marlow wrote:

I've put together a tutorial on Parallel and Concurrent programming in 
Haskell, here:


 http://community.haskell.org/~simonmar/par-tutorial.pdf

The main reason for writing this was that I needed some lecture notes for a 
course at the CEFP summer school next month, but I hope the material is 
useful to the Haskell community in general.


Thank you a lot for this overview!

Concerning the parallelisation of K-means: It seems to be difficult to 
choose a size for the pieces of points. Since the 'combine' function is 
associative something map-reduce-like seems to be applicable. That is, if 
there is a library function for a parallelised 'reduce' and I promise, 
that I call it with an associative function as argument, then the library 
could choose an appropriate size for the pieces. Is there already library 
support for parallelism of this style?


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


Re: [Haskell-cafe] Errors installing 'Haskell Charts'

2011-06-10 Thread Henning Thielemann


On Fri, 10 Jun 2011, Dmitri O.Kondratiev wrote:


/var/folders/Bo/BobN2Ap5GZW51e9o-n2Ack+++TI/-Tmp-/cairo-0.12.04207/cairo-0.12.0/Gtk2HsSetup.hs:201:69:
    Couldn't match expected type `PackageDBStack'
   against inferred type `PackageDB'
    In the sixth argument of `registerPackage', namely `packageDb'
    In the expression:
    registerPackage
  verbosity installedPkgInfo pkg lbi inplace packageDb
    In a case alternative:
    _ | modeGenerateRegFile - die Generate Reg File not supported
  | modeGenerateRegScript - die Generate Reg Script not supported
  | otherwise
  - registerPackage
   verbosity installedPkgInfo pkg lbi inplace packageDb


This looks like an incompatibility between cabal versions. Try switching 
between Cabal-1.10 and Cabal-1.8.


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


Re: [Haskell-cafe] Matplotlib analog for Haskell?

2011-06-10 Thread Henning Thielemann


On Sat, 11 Jun 2011, Dmitri O.Kondratiev wrote:


That's what I get (see below). What else should I do to install gnuplot?



~/wks/haskell-wks/gnuplot/gnuplot-0.4.2/srcghc -v Demo.hs


Do you really want to compile the Demo (with ghc)? It is already compiled 
if 'cabal install -fbuildExamples' was successful. Maybe you want to run 
'ghci' for interactive tests. But you need to tell 'ghci' the path to the 
Paths module. 'make ghci-demo' should call GHCi with the right options on 
Linux:


$ ghci -Wall -i:src:dist/build/autogen:execute/tmp src/Demo.hs



Did I already advertise the gnuplot mailing list?
  http://projects.haskell.org/cgi-bin/mailman/listinfo/gnuplot/

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


Re: [Haskell-cafe] Matplotlib analog for Haskell?

2011-06-10 Thread Henning Thielemann


On Sat, 11 Jun 2011, Dmitri O.Kondratiev wrote:


Yes, you did, thanks. Yet, please allow me to ask a few more questions here, 
before I subscribe to gnuplot list. I am really
short on time - must have some plots for demo next Monday (

1) Can current version of gnuplot draw histograms? I need these first of all.
2) It seems that $ ghci -Wall -i:src:dist/build/autogen:execute/tmp 
src/Demo.hs
works on Mac OSX, yet I can't make it produce any output directly on screen.
How to generate output and display it immediately in an output window?


Calling 'main' from the Demo module should open several gnuplot windows 
showing some examples. If it does not, then this might be a difference of 
gnuplot between Mac and Linux. For PNG output use the Terminal.PNG module 
instead of Terminal.X11. In the latest version from darcs repository, 
there is also histogram support and a demo of it.


darcs get http://code.haskell.org/gnuplot/

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


Re: [Haskell-cafe] Input and output of mathematical expressions

2011-06-09 Thread Henning Thielemann


On Thu, 9 Jun 2011, Jacek Generowicz wrote:



On 2011 Jun 9, at 16:59, Chris Smith wrote:

Ae you looking to do this in a web application, or client-side?  Since one 
of your requirements is to display a typeset equation, that makes a bit of 
difference.  In a web-based setting, the best way to do that is probably 
MathML, whereas a GUI will be a bit harder.


Yes, this pretty much summarizes my (ignorant) thoughts on it so far (GUI: 
hard; MathML: relatively easy), which is why I suspect that running it as a 
local web application might be the simplest way to go.


Concerning a local GUI: How about running LaTeX for Tex-PDF, generate a 
PNG from PDF by ghostscript and show the PNG?


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


Re: [Haskell-cafe] Replacing stdin from within Haskell

2011-06-09 Thread Henning Thielemann


On Thu, 9 Jun 2011, Neil Davies wrote:


Anyone out there got an elegant solution to being able to fork a haskell thread 
and replace its 'stdin' ?

Why do I want this - well I'm using the pcap library and I want to uncompress data to 
feed into 'openOffile' (which will take - to designate read from stdin). Yes 
I can create a separate command and use the stuff in System.Process or uncompress it into 
a temporary file - but that all seems in-elegant.


I think the clean solution is to have a parameter of type Handle, that the 
threads use for reading, instead of reading from stdin. Or pass the data 
from stdin in a lazy String.


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


Re: [Haskell-cafe] Comment Syntax

2011-06-06 Thread Henning Thielemann
Nicolas Wu schrieb:
 This whole discussion is reminding me of Wadler's Law of Language
 Design [1], it's nice to see that in 15 years things haven't changed
 much!
 
WADLER'S LAW OF LANGUAGE DESIGN
In any language design, the total time spent discussing
a feature in this list is proportional to two raised to
the power of its position.
 0. Semantics
 1. Syntax
 2. Lexical syntax
 3. Lexical syntax of comments
 
 [1] http://www.informatik.uni-kiel.de/~curry,/listarchive/0017.html

It's the first time, that I see a discussion about comment syntax in
Haskell-Cafe.

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


Re: [Haskell-cafe] Matplotlib analog for Haskell?

2011-06-03 Thread Henning Thielemann
Malcolm Wallace schrieb:
 I tried gnuplot: 

 Demo.hs:25:18:
 Could not find module `Paths_gnuplot':
   Use -v to see a list of the files searched for.
 Failed, modules loaded: none.
 Prelude Graphics.Gnuplot.Simple


 Where to get `Paths_gnuplot': module?
 
 $ cd gnuplot-0.4.2
 $ cabal install # this generates the Paths_gnuplot module
 $ ghci

Yes, you must install the package before loading Demo into GHCi, since
the package contains a data file that the Demo wants to load.

Currently I am trying to interface to gnuplot's histogram feature.

You may also to subscribe to
   http://projects.haskell.org/cgi-bin/mailman/listinfo/gnuplot


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


Re: [Haskell-cafe] Names for pretty-printing combinators

2011-06-02 Thread Henning Thielemann
Casey McCann schrieb:
 One drastic approach I've used in personal libraries--operator-heavy
 EDSLs specifically--is to define everything first with alphanumeric
 names, then put operators in their own modules. In some cases I'd have
 three such modules: One providing a minimal set of operators that don't
 clash with anything significant, one providing a larger set of operators
 that clash with one or more common modules (often deliberately, e.g.
 duplicating Arrow combinators for some type with similar semantics but
 no valid Arrow instance), and one providing a bunch of gratuitous
 Unicode operators that look pretty in my code editor but I don't know
 how to type in GHCi.

I use explicit imports in order to avoid infix operator clashes.


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


Re: [Haskell-cafe] *GROUP HUG*

2011-06-01 Thread Henning Thielemann
Adrien Haxaire schrieb:

 I fully agree. These are two of the three reasons which made me choose
 haskell as the functional language to learn. Coding fortran all day, I
 wanted a new approach on programming. The strong scientific roots of
 haskell would give me stuff to learn and discover for a lot of time. The
 atmosphere/halo around haskell was intriguing too: come on! it's fun! i
 can write foldr with foldl! is not the kind of enthusiasm I was used
 too :)

Really, you can write foldr in terms of foldl? So far I was glad I could
manage the opposite direction.


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


Re: [Haskell-cafe] Decimal type-level arithmetic.

2011-05-31 Thread Henning Thielemann


On Wed, 1 Jun 2011, Serguey Zefirov wrote:


I would like to present my version of type arithmetic with decimal
encoding: http://thesz.mskhug.ru/svn/hhdl/TyleA.hs


How does it compare to
  http://hackage.haskell.org/package/type-level
?

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


  1   2   3   4   5   6   7   8   9   10   >