Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-28 Thread Andrew Coppin

Erik de Castro Lopo wrote:

Andrew Coppin wrote:

  

Windows has more package management facilities than most people realise.

For example, go install Office 2007. In fact, just install Excel 2007, 
not the whole thing. Windows Installer can automatically figure out that 
you *do* need to install the Spell Checker (since Excel uses that), but 
you do *not* need to install the Grammar Checker (since only Word and 
PowerPoint use that, and you haven't selected to install those). Not 
only does it decide what to install, but you can query it 



Thats a specific installer for a specific program.
  


It is. But my point is, it's not the program installer itself that 
provides all this functionallity. It's the Windows operating system. A 
3rd party program can, for example, ask if component X of MS Office is 
installed, and if so, where it's located. You can set things up so that 
if some 3rd party needs to access a feature of MS Office that isn't 
currently installed, it installs it (if the installation files are 
cached; it used to ask for you to insert the install CD). For native 
Windows stuff, there are ways to check what version of DirectX is 
installed and update it if necessary; you don't have to write that code 
yourself, it's provided by the OS. Just like under (say) Debian, you 
don't have to implement apt-get yourself, it's provided for you.


About the only thing *not* provided is the ability to automatically 
fetch the installer for whatever it is you need. And that's because 
usually to obtain the installer, you need to *pay money* to whatever 
company it is that *sells* it.



The whole problem with windows is that every 3rd party program is
responsible for its own installation and removal and is free to 
do that in its own way. It also encourgaes monolithic installers,

installers that include everything.
  


Each application can of course install itself in its own way. For some, 
that's as simple as unzipping an install image and putting it somewhere 
convinient. For others, it means running an elaborate installation 
program. But, the point I'm trying to get at is, there *is* a standard 
installation system (which you can of course choose not to package your 
application with), and if you use it, it gives you things like 
dependency resolution and telling you what stuff is installed where and 
so on.


I agree with your last point, however; not having a central location 
where software can be obtained from *does* encourage monolithic 
installers. The installer is essentially a mini repo that contains the 
package and all its dependences; it then uses Windows to decide which 
[if any] of those dependencies are already installed or else need to be 
installed.



However, the software you are complaining about is mostly FOSS
software that had its genesis on Linux/Unix and assumes that
build dependencies can be resolved at compile time and that
install dependencies can be resolved at install time. Windows
of course fails these two assumptions completely.
  


On Linux, if I do, say, cabal install zlib, it falls over and tells me 
it can't find the zlib headers. So I go install them, rerun the command, 
and it works. On Windows, I issue the same command and it falls over and 
says that autoconf doesn't exist. It doesn't even *get* to the part 
where it looks for header files!


Interestingly, even though everybody claims that it's impossible to 
support C bindings on Windows, gtk2hs has managed it somehow. If you try 
to built it, it complains that it can't find the GTK+ headers. Go 
install those, add them to the search path, and suddenly it builds just 
fine. No problems with it. Go figure...



Until something like apt-get becomes popular, widespread and
well supported, you are going to continue to feel pain.


As I say, gtk2hs builds just fine today. (The upstream packaging of the 
Windows GTK+ port leaves a little to be desired, but that's not a 
Haskell problem.) It's as trivial as unpacking a few zip files and 
tweaking the search path.



hoping that Linux and Mac devs will fix windows problems
is not going to get you anywhere.
  


How about hoping that Linux and Mac devs are going to realise that 
Windows doesn't have some of the problems that people claim it does?


Hmm, thinking about it... nah, that's not happening anytime soon either. ;-)

I 
guess it depends on whether you think your students are going into 
datacenter support (probably Unix) or desktop support or application 
development (obviously all desktops are Windows).



Here's a funny thing. I know a large number of professional software
engineers and people who mix that with sys admin work. Only a tiny
fraction of those people write code for the windows platform. Do I
conclude from my data that most developers develop for Linux?
  


...which leads us back to my I guess it depends then?

My obviously all desktops are Windows was not meant to be entirely 
serious. But it's not exactly a revelation to state that 

[Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread João Paulo


Hello everyone,

I am developing a toolset in which I have several (multiparameter)  
type classes;


It is often the case that I can only define a data-type X as an  
instance of one such class (say A), if X is an instance of another  
class (say B);


The thing is that, while it is hard for me, because of all the type  
parameters that I have to deal with, to add


  'X is an instance of B'

to the context cxt_A in

  'instance cxt_A = A X'

ghc is always able to correctly infer all type parameters; In fact, I  
always get:


  'Could not deduce (B X t1 ... tn)
  from the context cxt_A arising from ...
   Probable fix: add (B X t1 ... tn) to the context cxt_A ...'

In my case, this is the fix that I always need: most of the times, I  
am just copy-pasting (B X t1 ... tn) to cxt_A!


Is there a way, say a compilation option, to avoid this?

can anyone please help me here? :)

thank you very much

--
João Paulo Fernandes
Universidade do Minho
www.di.uminho.pt/~jpaulo



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


Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Patrick Browne
Daniel Fischer wrote:
 class BEING human  = HUMAN human where
 Sub-classing is logical implication BEING(human)  = HUMAN(human)
 All types t that make BEING(t) = true also make HUMAN(t)=true
 
 No, it's the other way round. Every HUMAN is also a BEING, hence
 
 HUMAN(t) = BEING(t)

Could I say that HUMAN is a subset of BEING?

Sebastian Fischer wrote:
 You can define subclasses even if no instances exist. And as Daniel
 said, the code
 
 class BEING human = HUMAN human where
 
 defines a subclass HUMAN of BEING which means that every instance of
 HUMAN must also be a BEING. You can read it as: a BEING is also a HUMAN
 by the following definitions.

Thanks for pointing out my error
But I am still not sure of the interpretation of logical implication wrt
to sub-classes. Lets simplify the representation and just regard the
classes in the example as propositions (instead of predicates).
I am not sure if this simplification still makes the example valid.
Below is a reasonable interpretation of propositional logical implication.

a) If I wear a raincoat then I stay dry (sufficient condition)
wareRaincoat = stayDry
b) I will stay dry only if I ware a raincoat(necessary condition)
stayDry = wareRaincoat

In the light of the above examples how should I interpret the
class-to-subclass relation as logical implication? Is it
a)  If BEING then HUMAN (sufficient condition): BEING = HUMAN
b)  HUMAN is true only if BEING (necessary condition): HUMAN = BEING
c) Neither?

Thanks,
Pat


This message has been scanned for content and viruses by the DIT Information 
Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] multi-line strings (Was: Hackage on Linux)

2010-08-28 Thread Joachim Breitner
Hi,

Am Samstag, den 28.08.2010, 08:18 +1000 schrieb Ivan Lazar Miljenovic:
 On 28 August 2010 00:02, Felipe Lessa felipe.le...@gmail.com wrote:
  On 8/27/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:
  Admittedly, Haskell has no multi-line
  String support which would make defining something like the
  Description field harder...
 
  Quick correction: Haskell *does* have multi-line strings. For example:
 
 This is a\
 \ nice string
 
 I meant in the sense of Python, etc. where you didn't have to insert
 newline characters, etc. in.

A similar problem is solved by 
http://github.com/jgm/hsb2hs
which might be useful if you need to embed larger pieces of text.

Greetings,
Joachim

-- 
Joachim nomeata Breitner
  mail: m...@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nome...@joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nome...@debian.org


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] multi-line strings (Was: Hackage on Linux)

2010-08-28 Thread Ivan Lazar Miljenovic
On 28 August 2010 20:55, Joachim Breitner m...@joachim-breitner.de wrote:
 Hi,

 Am Samstag, den 28.08.2010, 08:18 +1000 schrieb Ivan Lazar Miljenovic:
 On 28 August 2010 00:02, Felipe Lessa felipe.le...@gmail.com wrote:
  On 8/27/10, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote:
  Admittedly, Haskell has no multi-line
  String support which would make defining something like the
  Description field harder...
 
  Quick correction: Haskell *does* have multi-line strings. For example:
 
     This is a\
     \ nice string

 I meant in the sense of Python, etc. where you didn't have to insert
 newline characters, etc. in.

 A similar problem is solved by
 http://github.com/jgm/hsb2hs
 which might be useful if you need to embed larger pieces of text.

Huh, very nice; thanks for the link.

Unfortunately, it doesn't look like John has released a version on
Hackage yet :(

Then again, the first commit on github was the beginning of this month...

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] multi-line strings (Was: Hackage on Linux)

2010-08-28 Thread Joachim Breitner
Hi,

Am Samstag, den 28.08.2010, 21:11 +1000 schrieb Ivan Lazar Miljenovic:
  A similar problem is solved by
  http://github.com/jgm/hsb2hs
  which might be useful if you need to embed larger pieces of text.
 
 Huh, very nice; thanks for the link.
 
 Unfortunately, it doesn't look like John has released a version on
 Hackage yet :(
 
 Then again, the first commit on github was the beginning of this month...

probably won’t happen, unless someone steps up as a maintainer (you?):
http://www.haskell.org/pipermail/haskell-cafe/2010-August/081398.html

Hmm, now that I look at the thread, you took part in it (when the
discussion turned to TH on different arches) :-)

Greetings,
Joachim

-- 
Joachim nomeata Breitner
  mail: m...@joachim-breitner.de | ICQ# 74513189 | GPG-Key: 4743206C
  JID: nome...@joachim-breitner.de | http://www.joachim-breitner.de/
  Debian Developer: nome...@debian.org


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haddock: Documentation of instances with un-documentable type arguments

2010-08-28 Thread Johannes Waldmann

  Perhaps Haddock could exclude class instance reporting when it cannot find a
  documentable link to a parameter?

The cannot find documentable link problem also comes up 
in situations like this (that don't involve type classes):

module Ex ( foo ) where
data Secret = Secret
foo = Secret

Should haddock generate documentation 
for foo (since it is exported) 
or not (since its result type is not exported)?

Now imagine something like instance Show Secret
(inside the Ex module).
The user of the module then can write show foo,
and so it should be documented?

J.W.


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


Re: [Haskell-cafe] multi-line strings (Was: Hackage on Linux)

2010-08-28 Thread Ivan Lazar Miljenovic
On 28 August 2010 21:33, Joachim Breitner m...@joachim-breitner.de wrote:
 Hi,

 Am Samstag, den 28.08.2010, 21:11 +1000 schrieb Ivan Lazar Miljenovic:
  A similar problem is solved by
  http://github.com/jgm/hsb2hs
  which might be useful if you need to embed larger pieces of text.

 Huh, very nice; thanks for the link.

 Unfortunately, it doesn't look like John has released a version on
 Hackage yet :(

 Then again, the first commit on github was the beginning of this month...

 probably won’t happen, unless someone steps up as a maintainer (you?):
 http://www.haskell.org/pipermail/haskell-cafe/2010-August/081398.html

 Hmm, now that I look at the thread, you took part in it (when the
 discussion turned to TH on different arches) :-)

Huh, that goes to show how many mailing list messages there are that I
forgot about that thread ;-)

I'd be willing to take over maintainership except I have about 3
different libraries I'm working on that need a lot of TLC, and I don't
really have a use case for hsb2hs (I don't do that much with Strings).

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Haddock: Documentation of instances with un-documentable type arguments

2010-08-28 Thread Ivan Lazar Miljenovic
On 28 August 2010 21:33, Johannes Waldmann waldm...@imn.htwk-leipzig.de wrote:

  Perhaps Haddock could exclude class instance reporting when it cannot find 
  a
  documentable link to a parameter?

 The cannot find documentable link problem also comes up
 in situations like this (that don't involve type classes):

 module Ex ( foo ) where
 data Secret = Secret
 foo = Secret

 Should haddock generate documentation
 for foo (since it is exported)
 or not (since its result type is not exported)?

The more important question is why doesn't it have a type signature? :p

How does GHC deal with that kind of situation?  Off the top of my
head, I would think that in terms of how you could use it, that would
be equivalent to also exporting Secret (the type, not the
constructor); i.e. module Ex (Secret, foo) where 

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Haddock: Documentation of instances with un-documentable type arguments

2010-08-28 Thread Johannes Waldmann


 in terms of how you could use it, that would
 be equivalent to also exporting Secret [...]

well, expect that you cannot use the type's name in signatures,
so you'd have to rely on type inference.

Out of curiosity I just checked javadoc's behaviour on

public class Ex {
public interface Show { }
static private class Secret implements Show { }
public Secret foo () { return new Secret (); }
static public class Known implements Show { }
public Known bar () { return new Known (); }
}

and it does generate documentation for all the public identifiers,
with a non-linked result type for foo,
and it does not list Secret among the known instances for Show.

Well, then I checked haddock (2.7.2) for

module Ex ( foo, bar, Known ) where
data Secret = Secret
foo = Secret
instance Show Secret
data Known = Known
bar = Known
instance Show Known

and it behaves identically (does not mention Secret as a known instance).

So, is this the behaviour that the original poster wanted?

J.W.c


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


Re: [Haskell-cafe] Re: Haddock: Documentation of instances with un-documentable type arguments

2010-08-28 Thread Gábor Lehel
On Sat, Aug 28, 2010 at 1:41 PM, Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com wrote:
 On 28 August 2010 21:33, Johannes Waldmann waldm...@imn.htwk-leipzig.de 
 wrote:

  Perhaps Haddock could exclude class instance reporting when it cannot 
  find a
  documentable link to a parameter?

 The cannot find documentable link problem also comes up
 in situations like this (that don't involve type classes):

 module Ex ( foo ) where
 data Secret = Secret
 foo = Secret

 Should haddock generate documentation
 for foo (since it is exported)
 or not (since its result type is not exported)?

 The more important question is why doesn't it have a type signature? :p

 How does GHC deal with that kind of situation?  Off the top of my
 head, I would think that in terms of how you could use it, that would
 be equivalent to also exporting Secret (the type, not the
 constructor); i.e. module Ex (Secret, foo) where 


I tried this once, because I was wondering the same thing. Basically
it works the way I expected: if you export functions which have a
given type in their signature, but the type is not exported, you can
use the functions and combine them however you want, but you can't
explicitly mention or use the unexported type anywhere. At the time I
actually had a use case in mind for why this would be useful, but I
can't remember what it was.

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.com
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
Work is punishment for failing to procrastinate effectively.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Re: Hackage on Linux

2010-08-28 Thread Magnus Therning
On 28/08/10 02:15, Ivan Lazar Miljenovic wrote:
 On 28 August 2010 11:09, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 On 8/27/10 05:58 , Simon Farnsworth wrote:
 If you don't mind, I'd like a proper reference for this; looking at the
 Linux kernel documentation as you suggest tells me that the kernelspace to
 userspace ABI is supposed to be 100% stable, such that I can take all the
 binaries (including shared libraries) from an i386 Linux 2.0 system, and
 run them in a chroot on my x86-64 Linux 2.6.35 system.

 Maybe it's supposed to be, but even with more recent stuff (like, say,
 binary GHC releases --- which use glibc shared even if Haskell libs aren't)
 I quite often see programs fail to run because the kernel changed something
 and the kernel/userspace interface changed as a result.  A written policy
 is worthless if it isn't followed.

 Well, I have no need to recompile glibc and packages that depend upon it
 every time I update my kernel...  So maybe glibc changes, but not the kernel
 AFAICT.

I've been following this part of the discussion with some interest.  Mainly
because I've been a Linux user since kernel version 1.2, and I've
*never* had
any of the problems people mention here.  So I'm wondering, what are you
doing
to your systems?

/M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org   Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Sebastian Fischer

Daniel Fischer wrote:

class BEING human  = HUMAN human where
Sub-classing is logical implication BEING(human)  = HUMAN(human)
All types t that make BEING(t) = true also make HUMAN(t)=true


No, it's the other way round. Every HUMAN is also a BEING, hence

HUMAN(t) = BEING(t)


Could I say that HUMAN is a subset of BEING?


That depends on whether predicates are sets.. But yes, every instance  
of HUMAN is also an instance of BEING, hence, the set of HUMAN  
instances is a subset of the set of BEING instances.



In the light of the above examples how should I interpret the
class-to-subclass relation as logical implication? Is it
a)  If BEING then HUMAN (sufficient condition): BEING = HUMAN
b)  HUMAN is true only if BEING (necessary condition): HUMAN = BEING
c) Neither?


b). Every HUMAN is a BEING.

Cheers,
Sebastian

--
Underestimating the novelty of the future is a time-honored tradition.
(D.G.)



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


Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-28 Thread Magnus Therning
On 28/08/10 09:55, Andrew Coppin wrote:
[...]
 How about hoping that Linux and Mac devs are going to realise that Windows
 doesn't have some of the problems that people claim it does?

 Hmm, thinking about it... nah, that's not happening anytime soon either.
 ;-)

Can you provide some links to further information, please?

/M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org   Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe



signature.asc
Description: OpenPGP digital signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] type classes and logic

2010-08-28 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/28/10 06:17 , Patrick Browne wrote:
 In the light of the above examples how should I interpret the
 class-to-subclass relation as logical implication? Is it
 a)  If BEING then HUMAN (sufficient condition): BEING = HUMAN
 b)  HUMAN is true only if BEING (necessary condition): HUMAN = BEING
 c) Neither?

(b).  But there's an additional wrinkle:  what it really says is A HUMAN is
(...).  Oh, and it's a BEING too.  Which is to say, Haskell doesn't look at
BEING until *after* it's decided something is a HUMAN.  (Technically
speaking, constraints are not used when selecting an instance; they're
applied after the fact, and if the selected instance doesn't conform then it
throws a type error.)

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx5KOcACgkQIn7hlCsL25UWyQCfTblcgeEfwOci9KE7leVs07aN
VT4AoJAwHqXoD6nbD+TZVRlAWj3N99SM
=jA0B
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)

2010-08-28 Thread Sean Leather
On Sat, Aug 28, 2010 at 01:29, Vo Minh Thu wrote:

 It would be interesting to know some other sources: [...] number of
 attendees to e.g. Utrecht
 summer school on FP, ...


Just a bit over 30, I think. And it was interesting to see a significant
number of non-student participants. Perhaps around 20%.

As an aside, we had some interesting projects, too. Sokoban in curses,
DSP/sound DSL, regex visualization, Bash code escaping, etc. I hope to see
some of them appear on Hackage soon.

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


Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)

2010-08-28 Thread Vo Minh Thu
2010/8/28 Sean Leather leat...@cs.uu.nl:
 On Sat, Aug 28, 2010 at 01:29, Vo Minh Thu wrote:

 It would be interesting to know some other sources: [...] number of
 attendees to e.g. Utrecht
 summer school on FP, ...

 Just a bit over 30, I think. And it was interesting to see a significant
 number of non-student participants. Perhaps around 20%.

 As an aside, we had some interesting projects, too. Sokoban in curses,
 DSP/sound DSL, regex visualization, Bash code escaping, etc. I hope to see
 some of them appear on Hackage soon.

That's the kind of aside that are so interesting. Please (fell free
to) share some more insight of it in your blog if you've some time :)

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


Re: [Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread Carter Schonwald
 i believe that a valid idiom is to define a class C that has no  functions,
but requires  any instance   to also be of type classes A and B, so that you
can write: C a = blah
rather than (A a,B a)= blah, though I don't know how often such is used in
practice

the same idea should apply more generally to multiparam type classes

On Sat, Aug 28, 2010 at 5:44 AM, João Paulo jpa...@di.uminho.pt wrote:


 Hello everyone,

 I am developing a toolset in which I have several (multiparameter) type
 classes;

 It is often the case that I can only define a data-type X as an instance of
 one such class (say A), if X is an instance of another class (say B);

 The thing is that, while it is hard for me, because of all the type
 parameters that I have to deal with, to add

  'X is an instance of B'

 to the context cxt_A in

  'instance cxt_A = A X'

 ghc is always able to correctly infer all type parameters; In fact, I
 always get:

  'Could not deduce (B X t1 ... tn)
  from the context cxt_A arising from ...
   Probable fix: add (B X t1 ... tn) to the context cxt_A ...'

 In my case, this is the fix that I always need: most of the times, I am
 just copy-pasting (B X t1 ... tn) to cxt_A!

 Is there a way, say a compilation option, to avoid this?

 can anyone please help me here? :)

 thank you very much

 --
 João Paulo Fernandes
 Universidade do Minho
 www.di.uminho.pt/~jpaulo



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

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


Re: [Haskell-cafe] (automatic) type classes context inference

2010-08-28 Thread Evan Laforge
On Sat, Aug 28, 2010 at 12:22 PM, Carter Schonwald
carter.schonw...@gmail.com wrote:
  i believe that a valid idiom is to define a class C that has no  functions,
 but requires  any instance   to also be of type classes A and B, so that you
 can write: C a = blah
 rather than (A a,B a)= blah, though I don't know how often such is used in
 practice
 the same idea should apply more generally to multiparam type classes

I've done this.  It's handy not only for reducing class context noise,
but also keeping implementation details from leaking out the
interface.  It looks funny when some function randomly requires its
parameter to be Storable just because somewhere down the line someone
else needs it, and it's awkward when a whole interface requires the
same 4 typeclasses on every function.

Of course, if you want to write a new type that can be passed, you do
need to implement those classes, so from the point of view of that
user it's not an implementation detail.  But from the point of view of
someone just passing in data, not writing their own instances, it's
awkward to have to keep writing a random bunch of class contexts that
reflect the implementation of a function and may break if that
implementation changes.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Unicode pretty-printing

2010-08-28 Thread Peter Gromov
Hi all,

I've been considering using Haskell for my natural language processing
project. Due to its nature, it has much to do with Unicode.
Unfortunately, Haskell escapes UTF8 characters. I've been able to
output these strings via System.IO.UTF8.putStrLn (though I wish it was
less painful), but still there are two problems.

First, I want to pretty-print not only strings, but any structures
made of lists and algebraic data types. Their 'show' calls string's
'show' which escapes all UTF8 symbols.

The second problem is that I'm not the only one who wants to output
the structures. For example, I want to have tests which check that
certain operations produce certain natural language strings. So, I
considered using HUnit for that. When its assertEqual fails, it
displays the expected versus actual data, which is fine. But, of
course, it doesn't know anything about Unicode, and I can't read
escaped strings very well to understand what exactly has failed. I
really don't want to write yet another unit test framework only for
the sake of UTF8. Is there any way to make Haskell display values
containing Unicode strings in a readable way?

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


Re: [Haskell-cafe] Unicode pretty-printing

2010-08-28 Thread Don Stewart
gromopetr:
 Hi all,
 
 I've been considering using Haskell for my natural language processing
 project. Due to its nature, it has much to do with Unicode.
 Unfortunately, Haskell escapes UTF8 characters. I've been able to
 output these strings via System.IO.UTF8.putStrLn (though I wish it was
 less painful), but still there are two problems.
 
 First, I want to pretty-print not only strings, but any structures
 made of lists and algebraic data types. Their 'show' calls string's
 'show' which escapes all UTF8 symbols.

How about a Pretty class for unicode text:
http://hackage.haskell.org/package/text

That might be easy to write.
  
 displays the expected versus actual data, which is fine. But, of
 course, it doesn't know anything about Unicode, and I can't read
 escaped strings very well to understand what exactly has failed. I
 really don't want to write yet another unit test framework only for
 the sake of UTF8. Is there any way to make Haskell display values
 containing Unicode strings in a readable way?

Via a new pretty class, similar to Show, but rendering Text values.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Fwd: Semantics of iteratees, enumerators, enumeratees?

2010-08-28 Thread Tilo Wiklund
On 26/08/2010, Daniel Fischer daniel.is.fisc...@web.de wrote:
 [...]
 Well, I just gave an example where one would want chunking for reasons
 other than performance. That iteratees don't provide the desired
 functionality is a different matter.
 [...]


In the case of hashing, wouldn't it be more reasonable to consider
iterators over streams of fixed (or at least predictable) sized chunks
(where a set of chunks can themselves be chunked), with the chunking
behaviour being given by another iteratee over the original stream?

It seems to me that one of the major points of iteratees is to provide
an abstraction from the kind of chunking irrelevant to the parsing
logic, otherwise I fail to see any difference (at least relevant to
chunking) to plain strict IO.

I'm not particularly well read on anything here, so I could just
totally miss what is going on, in which case I apologise.

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


[Haskell-cafe] On to applicative

2010-08-28 Thread michael rice
I'm looking at a discussion of Either (as functor) here:

http://learnyouahaskell.com/making-our-own-types-and-typeclasses#the-functor-typeclass

instance Functor (Either a) where  
    fmap f (Right x) = Right (f x)  
    fmap f (Left x) = Left x



And this line in Data.Either

Functor (Either a)

but no fmap defined here.


How come?

Michael




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


Re: [Haskell-cafe] Re: Support for lock-free/wait-free programming?

2010-08-28 Thread Gregory Collins
Gabriel Wicke wi...@wikidev.net writes:

 On Tue, 17 Aug 2010 01:09:41 -0400, Gregory Collins wrote:

 Hello all,
 
 Does GHC expose any primitives for things like atomic compare-and-swap?
 I can't seem to find anything in the docs. 

 Hello Gregory,

 I have recently published experimental and low-level FFI bindings to
 GCC's atomic primitives including CAS as 'bits-extras' on Hackage [1].
 Instances for Int and Word types are included.

 This is likely lower-level than what you are after, but might still be
 handy for experimentation.

On OSX libgcc_s is only supplied as a dynamic library, which GHC doesn't
seem to be able to link with. Any ideas would be appreciated.

G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-28 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/28/10 20:43 , michael rice wrote:
 I'm looking at a discussion of Either (as functor) here:
 
 http://learnyouahaskell.com/making-our-own-types-and-typeclasses#the-functor-typeclass
 
 instance Functor (Either a) where  
 fmap f (Right x) = Right (f x)  
 fmap f (Left x) = Left x
 
 And this line in Data.Either
 
 Functor (Either a)
 
 but no fmap defined here.
 
 How come?

Historical accident, to wit:  Haskell 98 minimally defined Either in the
Prelude, so in practice we get the basic definitions (Either itself and its
Functor and Monad instances) from the Prelude and other utility functions
from Data.Either.

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx5sq4ACgkQIn7hlCsL25WA+QCeKUOuNN4kUpci9fH6BcFZ5WqG
bX8AoIBImpWLoxVz7kcwVIuHycYR/v5G
=EaIs
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Support for lock-free/wait-free programming?

2010-08-28 Thread Gregory Collins
Gregory Collins g...@gregorycollins.net writes:

 Gabriel Wicke wi...@wikidev.net writes:

 On Tue, 17 Aug 2010 01:09:41 -0400, Gregory Collins wrote:

 Hello all,
 
 Does GHC expose any primitives for things like atomic compare-and-swap?
 I can't seem to find anything in the docs. 

 Hello Gregory,

 I have recently published experimental and low-level FFI bindings to
 GCC's atomic primitives including CAS as 'bits-extras' on Hackage [1].
 Instances for Int and Word types are included.

 This is likely lower-level than what you are after, but might still be
 handy for experimentation.

 On OSX libgcc_s is only supplied as a dynamic library, which GHC doesn't
 seem to be able to link with. Any ideas would be appreciated.

It works with this patch:

--
Remove cc-options field from .cabal; the flags given don't work on OSX

diff --git a/bits-extras.cabal b/bits-extras.cabal
--- a/bits-extras.cabal
+++ b/bits-extras.cabal
@@ -42,8 +42,6 @@
 --CC-Options:   -O3 -fomit-frame-pointer -march=native -Wall
 -- Try link-time optimization (inlining) with gcc 4.5:
 -- CC-Options:   -fomit-frame-pointer -march=native -Wall -flto
-CC-Options:   -fomit-frame-pointer -march=native -Wall
-Extra-Libraries:  gcc_s
 Include-Dirs: cbits
 Install-Includes: bitops-gcc.h atomic-bitops-gcc.h
 Extensions:   ForeignFunctionInterface
--


G
-- 
Gregory Collins g...@gregorycollins.net
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-28 Thread Erik de Castro Lopo
Andrew Coppin wrote:

 On Linux, if I do, say, cabal install zlib, it falls over and tells me 
 it can't find the zlib headers. So I go install them, rerun the command, 
 and it works. On Windows, I issue the same command and it falls over and 
 says that autoconf doesn't exist. It doesn't even *get* to the part 
 where it looks for header files!

You are trying to build code that is designed on and for Linux. As such
it will probably work on all variants of Linux, Mac OSX and a majority
of Unix variants (after installation of the required GNU tools).

Unsurprisingly it does work on windows because windows because windows
does just about everything differently to the Linux and the rest of
the world does it.
 
 Interestingly, even though everybody claims that it's impossible to 
 support C bindings on Windows, gtk2hs has managed it somehow. If you try 
 to built it, it complains that it can't find the GTK+ headers. Go 
 install those, add them to the search path, and suddenly it builds just 
 fine. No problems with it. Go figure...

The reason that works is probably because whoever released it had
a windows machine available and took the time to make it work.

In general, code written on and for Linux/Unix is not going compile
with little problem on most Unix-style OSes and close to zero chance
of compiling without siginficant work on windows.
 
 How about hoping that Linux and Mac devs are going to realise that 
 Windows doesn't have some of the problems that people claim it does?

The problems I claim windows has with respect to compiling and
installing FOSS:

  a) No standard place to find C include files.
  b) No standard place to find libraries.
  c) No standard way to find if common open source libraries are
 installed and where.
  d) Missing common unix tools like bash. awk, sed, grep, make,
 autoconf, automake, libtool, pkg-config etc.

Ideally for installing open source libraries the tools used should be
the same as the ones used on Linux/Unix where they originated.

 My obviously all desktops are Windows was not meant to be entirely 
 serious. But it's not exactly a revelation to state that Windows has 
 much greater penetration in the desktop market than either Linux or 
 indeed Mac OS. Linux is much more popular now than it used to be (e.g., 
 I can remember when you had to wear open-toed sandals and eat lentil 
 burgers in order to run Linux), but it's not yet anywhere near the level 
 of popularity of Windows.

Your assessment is valid for user desktops but highly questionable
for developer desktops.


Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Hackage on Linux

2010-08-28 Thread Erik de Castro Lopo


Hmm, Sunday morning reply before caffeine.

Erik de Castro Lopo wrote:

 Andrew Coppin wrote:
 
  On Linux, if I do, say, cabal install zlib, it falls over and tells me 
  it can't find the zlib headers. So I go install them, rerun the command, 
  and it works. On Windows, I issue the same command and it falls over and 
  says that autoconf doesn't exist. It doesn't even *get* to the part 
  where it looks for header files!
 
 You are trying to build code that is designed on and for Linux. As such
 it will probably work on all variants of Linux, Mac OSX and a majority
 of Unix variants (after installation of the required GNU tools).
 
 Unsurprisingly it does work on windows because windows because windows

^not

 does just about everything differently to the Linux and the rest of
 the world does it.
  
  Interestingly, even though everybody claims that it's impossible to 
  support C bindings on Windows, gtk2hs has managed it somehow. If you try 
  to built it, it complains that it can't find the GTK+ headers. Go 
  install those, add them to the search path, and suddenly it builds just 
  fine. No problems with it. Go figure...
 
 The reason that works is probably because whoever released it had
 a windows machine available and took the time to make it work.
 
 In general, code written on and for Linux/Unix is not going compile

Remove 'not' in the line above.

 with little problem on most Unix-style OSes and close to zero chance
 of compiling without siginficant work on windows.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-28 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/28/10 22:15 , michael rice wrote:
 Prelude fmap (*2) l
 
 interactive:1:0:
 No instance for (Functor (Either Integer))
   arising from a use of `fmap' at interactive:1:0-10
 Possible fix:
   add an instance declaration for (Functor (Either Integer))
 In the expression: fmap (* 2) l
 In the definition of `it': it = fmap (* 2) l
 Prelude

Huh.  I understood it to be defined in the Prelude, but didn't check.

Looks like it's now in Control.Monad.Instances (a relatively new module).
Confusing

- -- 
brandon s. allbery [linux,solaris,freebsd,perl]  allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university  KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx5yW0ACgkQIn7hlCsL25VpMACeJR2GVmy1XvOMLtze7s0z3jaZ
t5sAnirMJhfh4ZYdMzJBdPbdUs8s166L
=OXTs
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] On to applicative

2010-08-28 Thread michael rice
Thanks, Brandon.

Michael

--- On Sat, 8/28/10, Brandon S Allbery KF8NH allb...@ece.cmu.edu wrote:

From: Brandon S Allbery KF8NH allb...@ece.cmu.edu
Subject: Re: [Haskell-cafe] On to applicative
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Saturday, August 28, 2010, 10:43 PM

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/28/10 22:15 , michael rice wrote:
 Prelude fmap (*2) l
 
 interactive:1:0:
     No instance for (Functor (Either Integer))
       arising from a use of `fmap' at interactive:1:0-10
     Possible fix:
       add an instance declaration for (Functor (Either Integer))
     In the expression: fmap (* 2) l
     In the definition of `it': it = fmap (* 2) l
 Prelude

Huh.  I understood it to be defined in the Prelude, but didn't check.

Looks like it's now in Control.Monad.Instances (a relatively new module).
Confusing

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allb...@kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkx5yW0ACgkQIn7hlCsL25VpMACeJR2GVmy1XvOMLtze7s0z3jaZ
t5sAnirMJhfh4ZYdMzJBdPbdUs8s166L
=OXTs
-END PGP SIGNATURE-



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