Re: [Haskell-cafe] Functional programmer's intuition for adjunctions?

2008-03-05 Thread Kim-Ee Yeoh


ajb-2 wrote:
> 
> In Haskell, natural transformations are
> functions that respect the structure of functors.  Since you can't
> avoid respecting the structure of functors (the language won't let you
> do otherwise), you get natural transformations for free. (Free as 
> in theorems, not free as in beer.)
> 

It's worth noting that polymorphism is one of those unavoidable,
albeit hidden, functors. Polymorphizing a function "forall a" can 
be thought of as lifting it via the ((->) T_a) functor, where T_a
is the type variable of "a". E.g. reverse really has the signature
T_a -> [a] -> [a].

But ((->) T_a) is left adjoint to ((,) T_a), which just happens
to be the analogous type-explicit way of representing existentials.

Adjunctions are a useful tool to describe and analyze such
dualities precisely.


ajb-2 wrote:
> 
> Adjunctions, on the other hand, you have to make yourself.  As such,
> they're more like monads.
> 

Constructing adjunctions, comprising as they do of a pair of 
functors, does seem double the work of a single monad. Duality
OTOH is a powerful guiding principle and may well be easier than
working with the monad laws directly. 

And besides, you get a comonad for free.


ajb-2 wrote:
> 
> One thing that springs to mind is that an adjunction could connect
> monads and their associated comonads.  Is that a good picture?
> 

Definitely.

-- 
View this message in context: 
http://www.nabble.com/Functional-programmer%27s-intuition-for-adjunctions--tp15832225p15866753.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


[Haskell-cafe] Haddock Documentation for Yhc Web Service available online

2008-03-05 Thread Dimitry Golubovsky
Hi,

I have regenerated Haddock documentation for Haskell modules included
into the Yhc Web Service.

http://www.golubovsky.org:5984/_utils/yhcws/index.html

Thanks.

-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Doubting Haskell

2008-03-05 Thread Richard A. O'Keefe
Concerning the Haskell program that does some statistics and displays  
some graphs,
I must say that if that were the task I had to solve I would not use  
either C++ or Haskell,
but R, the open source S lookalike.  The best way to be productive as  
a programmer
is to not write code if you can steal it.  R looks like an imperative  
language, but it is
"value-oriented" in the same way that SETL is, so is by some criteria  
a functional language

of sorts.

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


Re: [Haskell-cafe] Functional programmer's intuition for adjunctions?

2008-03-05 Thread ajb

G'day all.

Quoting Derek Elkins <[EMAIL PROTECTED]>:


Of course, this is a concrete example using basic ideas of programming
and not some "intuitive analogy".  I feel comfortable working with
adjunctions, but I don't have some general analogy that I use.


I think this is important.  The concept of an adjunction isn't like that
of a natural transformation.  In Haskell, natural transformations are
functions that respect the structure of functors.  Since you can't
avoid respecting the structure of functors (the language won't let you
do otherwise), you get natural transformations for free.  (Free as in
theorems, not free as in beer.)

Adjunctions, on the other hand, you have to make yourself.  As such,
they're more like monads.

I use at least three distinct pictures when I'm working with monads:

  - Overloaded semicolon.
  - Functorial container (e.g. lists).
  - Term substitution system.

...but even that doesn't fully cover all the possibilities that monads
give you.  Monads are what they are, and you use them when it seems
to make sense to implement the Monad interface for them.

It's sometimes only obvious that an interface is conformed to after the
event.  For example, consider Data.Supply:

  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/value-supply-0.1

It's clear in retrospect that Supply is a comonad, but probably neither
the paper authors nor the package author, smart as they are, noticed
this at the time of writing, because you need experience with comonads
to identify them.

I think it's the same with adjunctions.

Having said that, I think it makes sense to come up with some example
pictures, much like the example pictures of monads that people use.

Looking at those examples again:

phi :: (F a -> b) -> (a -> U b)
phiInv :: (a -> U b) -> (F a -> b)

One thing that springs to mind is that an adjunction could connect
monads and their associated comonads.  Is that a good picture?

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


Re: [Haskell-cafe] Issues(Bugs?) with GHC Type Families

2008-03-05 Thread Hugo Pacheco
Just something I have been wondering.

I would like to implement somehting like:

type family F a :: * -> *
...
class C a b where ...
instance (F a ~ F b) => C a b where ...

But apparently type equality coercions can not be used as a single context.
If I enable -fallow-undecidable-instances, whenever the equality does not
hold, the instance returns a compile error, what does make sense.

Is there any way I could overcome this?

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


Re: [Haskell-cafe] Doubting Haskell

2008-03-05 Thread Lennart Augustsson
Thanks for an interesting write-up.  And not bad for a first Haskell
program. :)
There's still a number of things you could do to limit the boiler plate
code, though.

On Tue, Mar 4, 2008 at 6:29 AM, Alan Carter <[EMAIL PROTECTED]> wrote:

> Many thanks for the explanations when I was first experimenting with
> Haskell. I managed to finish translating a C++ wxWidgets program into
> Haskell wxHaskell, and am certainly impressed.
>
> I've written up some reflections on my newbie experience together with
> both versions, which might be helpful to people interested in
> popularizing Haskell, at:
>
> http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/
>
> Regards,
>
> Alan
>
> --
> ... the PA system was moaning unctuously, like a lady hippopotamus
> reading A. E. Housman ..."
>  -- James Blish, "They Shall Have Stars"
> ___
> 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] Connection helpers: for people interested in network code

2008-03-05 Thread Don Stewart
nominolo:
> 
> On 5 mar 2008, at 22.05, Bjorn Bringert wrote:
> >
> >There is some (dormant?) work on bringing HTTP into the age of the
> >ByteString. Thomas Schilling (nominolo) might be able to tell you more
> >about it.
> >
> 
> Well, I can say with certainty that I won't have the time nor energy  
> to bring this into a usable state anytime soon (speak: not this  
> year).  I think it's unlikely that Jonas will, either.  Our work was  
> a quick hack, meant mainly as a proof of concept.  Doing it well  
> would require work and more knowledge of the HTTP protocol than I  
> have, ATM.  I agree that it would be valuable to the community, but  
> it's not gonna be me.
> 
> I wonder, though, what happened to the curl bindings for Haskell?   
> This was a Summer of Code project last year.  Also Johan Tibell  
> expressed some interest in getting bytestrings for HTTP.

$ git clone http://code.haskell.org/curl.git

:)

But really, we want an no-errors bytestring-efficient http of our own.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Connection helpers: for people interested in network code

2008-03-05 Thread Thomas Schilling


On 5 mar 2008, at 22.05, Bjorn Bringert wrote:


There is some (dormant?) work on bringing HTTP into the age of the
ByteString. Thomas Schilling (nominolo) might be able to tell you more
about it.



Well, I can say with certainty that I won't have the time nor energy  
to bring this into a usable state anytime soon (speak: not this  
year).  I think it's unlikely that Jonas will, either.  Our work was  
a quick hack, meant mainly as a proof of concept.  Doing it well  
would require work and more knowledge of the HTTP protocol than I  
have, ATM.  I agree that it would be valuable to the community, but  
it's not gonna be me.


I wonder, though, what happened to the curl bindings for Haskell?   
This was a Summer of Code project last year.  Also Johan Tibell  
expressed some interest in getting bytestrings for HTTP.


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


Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Sebastian Sylvan
On Wed, Mar 5, 2008 at 6:52 PM, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote:

> Jonathan Gardner wrote:
>
> > Where do I get started in writing a web app with Haskell? I am looking
> > more for a framework like Pylons and less like Apache, if that helps.
>
> The closest we currently have to a web framework is Happs
> (http://happs.org/), but it uses the kitchen sink of advanced and
> unusual language extensions, which I think might be why it hasn't got
> all that much momentum.
>
> There's also WASH, but that has an even lower profile.  I couldn't tell
> you if it sees much use, or even builds with recent compilers.
>

My web host has GHC 6.6 and it builds fine. I like WASH quite a lot, though
it may be a bit heavy-weight for certain applications in the way it does
sessions (though it works really well e.g. when users click the back button
etc.). Maybe zipping up the session state or something would help there (or
maybe it already does this?) - on my simple toy site it takes up around 30%
of the total size, which is a bit hefty.
Oh yeah, I use the preprocessor thing to get the nice syntax, but it's a bit
messy when things go wrong since it passes through a preprocessor before
being compiled.


-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Connection helpers: for people interested in network code

2008-03-05 Thread Bjorn Bringert
On Tue, Mar 4, 2008 at 5:15 PM, Adam Langley <[EMAIL PROTECTED]> wrote:
> On Tue, Mar 4, 2008 at 7:31 AM, Bjorn Bringert <[EMAIL PROTECTED]> wrote:
>  >  you may want to have a look at the socket abstraction used in the HTTP 
> package:
>  >
>  >  
> http://hackage.haskell.org/packages/archive/HTTP/3001.0.4/doc/html/Network-Stream.html
>  >
>  >  It would be great to get HTTPS support going!
>
>  I should have mentioned that I had seen this in the original email. I
>  think the major problem with this interface was that it was written in
>  the time before ByteStrings. Now that we have ByteStrings I think that
>  it makes a lot of sense for networking to use them.
>
>  However, it shouldn't be too hard to wrap HsOpenSSL in this interface.
>  I might try this this week. Then HTTPS should Just Work (maybe ;)

There is some (dormant?) work on bringing HTTP into the age of the
ByteString. Thomas Schilling (nominolo) might be able to tell you more
about it.

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


Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Adam Langley
On Wed, Mar 5, 2008 at 11:07 AM, Bryan O'Sullivan <[EMAIL PROTECTED]> wrote:
>  Indeed.  In addition to the code you mention, people like Adam Langley
>  and Johan Tibbell are taking on corners of the web app problem space in
>  a more modern context.

I should probably speak up then ;)

I'm (slowly) writing Network.MiniHTTP. What it does have is a modern,
ByteString based HTTP parser and serialiser (in decent shape), SSL
support (only in darcs at the moment) and my test case, that I'm
working towards, is an OpenID consumer. Once I have that working, I'll
do a second release. It's not that far off, it's just a question of
time.


AGL

-- 
Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Bryan O'Sullivan
Don Stewart wrote:

> Perhaps it is time for a haskell web apps wiki page, if there isn't one,
> outlining the approaches, 

Indeed.  In addition to the code you mention, people like Adam Langley
and Johan Tibbell are taking on corners of the web app problem space in
a more modern context.

It's going to be an interesting year or two; I only wish we could
accelerate the arrival of this particular portion of the future.  We
have a hole in "Real World Haskell" for writing about web development
that we can't satisfactorily fill with what's currently available.

http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Don Stewart
bos:
> Jonathan Gardner wrote:
> 
> > Where do I get started in writing a web app with Haskell? I am looking
> > more for a framework like Pylons and less like Apache, if that helps.
> 
> The closest we currently have to a web framework is Happs
> (http://happs.org/), but it uses the kitchen sink of advanced and
> unusual language extensions, which I think might be why it hasn't got
> all that much momentum.
> 
> There's also WASH, but that has an even lower profile.  I couldn't tell
> you if it sees much use, or even builds with recent compilers.

Perhaps it is time for a haskell web apps wiki page, if there isn't one,
outlining the approaches, with a structure like:

* HAppS
* CGI
- FastCGI

* Database solutions
- HDBC
- Takusen

* Templating
- HStringTemplate

* JSON rpc

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


Re: [Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Bryan O'Sullivan
Jonathan Gardner wrote:

> Where do I get started in writing a web app with Haskell? I am looking
> more for a framework like Pylons and less like Apache, if that helps.

The closest we currently have to a web framework is Happs
(http://happs.org/), but it uses the kitchen sink of advanced and
unusual language extensions, which I think might be why it hasn't got
all that much momentum.

There's also WASH, but that has an even lower profile.  I couldn't tell
you if it sees much use, or even builds with recent compilers.

http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Starting Haskell with a web application

2008-03-05 Thread Jonathan Gardner
I am sure I am missing something obvious, but since the cafe is the
place to ask stupid questions...

I am getting more and more excited about Haskell as I learn more and
more about it. Professionally, and as a hobby, I love working on web
applications.

Where do I get started in writing a web app with Haskell? I am looking
more for a framework like Pylons and less like Apache, if that helps.

I am sure someone has already done the homework on this, so a link will be fine.

-- 
Jonathan Gardner
[EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Yhc] Yhc Web Service quietly opened for public testing

2008-03-05 Thread Dimitry Golubovsky
Justin,

On 3/5/08, Justin Bailey <[EMAIL PROTECTED]> wrote:

> Does this take a Haskell program and compile it to JavaScript? That's
> pretty amazing.

Yes, exactly. The two user interface programs, MainGUI and NewEntry
were written in Haskell and compiled into Javascript by the same
tools. With minimal changes they are pasteable/compilable by this
service as well. See
http://haskell.org/pipermail/yhc/2008-March/001194.html - anybody
wants to try?

I suggested this relatively simple program as a test example just to
make sure results would be similar for everybody. More complex issues
may arise e. g. with CSS interpreted differently by FF vs MSIE; this
needs to work on in the future.

Thanks for your interest.

-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Re: [Yhc] Yhc Web Service quietly opened for public testing

2008-03-05 Thread Justin Bailey
>  2008/3/4, Dimitry Golubovsky <[EMAIL PROTECTED]>:
>  > Hi,
>  >
>  >  I finally got the Yhc Web Service (web-based front end to the
>  >  compiler) running in public testing mode. There hasn't been any
>  >  documentation written, and Haddock stuff not brought in order, but if
>  >  anyone wants to just get a taste of it, please open this hpaste entry:
>  >
>  >  http://hpaste.org/6094

Does this take a Haskell program and compile it to JavaScript? That's
pretty amazing.

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


[Haskell-cafe] 2nd CFP: PLMMS 2008

2008-03-05 Thread Jacques Carette


 SECOND CALL FOR PAPERS

 * UPDATE: Post-workshop proceedings in Journal of Automated Reasoning
 * UPDATE: Invited talk by Conor McBride


   Second Workshop on
Programming Languages for Mechanized Mathematics
 (PLMMS 2008)

 http://events.cs.bham.ac.uk/cicm08/workshops/plmms/

   As part of CICM / Calculemus 2008
Birmingham, UK, 28-29 July 2008


This workshop is focused on the intersection of programming languages
(PL) and mechanized mathematics systems (MMS). The latter category
subsumes present-day computer algebra systems (CAS), interactive proof
assistants (PA), and automated theorem provers (ATP), all heading
towards fully integrated mechanized mathematical assistants that are
expected to emerge eventually (cf. the objective of Calculemus).

The two subjects of PL and MMS meet in the following topics, which are
of particular interest to this workshop:

 * Dedicated input languages for MMS: covers all aspects of languages
   intended for the user to deploy or extend the system, both
   algorithmic and declarative ones. Typical examples are tactic
   definition languages such as Ltac in Coq, mathematical proof
   languages as in Mizar or Isar, or specialized programming
   languages built into CA systems. Of particular interest are the
   semantics of those languages, especially when current ones are
   untyped.

 * Mathematical modeling languages used for programming: covers the
   relation of logical descriptions vs. algorithmic content. For
   instance the logic of ACL2 extends a version of Lisp, that of Coq
   is close to Haskell, and some portions of HOL are similar to ML
   and Haskell, while Maple tries to do both simultaneously. Such
   mathematical languages offer rich specification capabilities,
   which are rarely available in regular programming languages. How
   can programming benefit from mathematical concepts, without
   limiting mathematics to the computational worldview?

 * Programming languages with mathematical specifications: covers
   advanced "mathematical" concepts in programming languages that
   improve the expressive power of functional specifications, type
   systems, module systems etc. Programming languages with dependent
   types are of particular interest here, as is intentionality vs
   extensionality.

 * Language elements for program verification: covers specific means
   built into a language to facilitate correctness proofs using MMS.
   For example, logical annotations within programs may be turned
   into verification conditions to be solved in a proof assistant
   eventually. How need MMS and PL to be improved to make this work
   conveniently and in a mathematically appealing way?

These issues have a very colorful history. Many PL innovations first
appeared in either CA or proof systems first, before migrating into
more mainstream programming languages. Some examples include type
inference, dependent types, generics, term-rewriting, first-class
types, first-class expressions, first-class modules, code extraction
etc. However, such innovations were never aggressively pursued by
builders of MMS, but often reconstructed by programming language
researchers. This workshop is an opportunity to present the latest
innovations in MMS design that may be relevant to future programming
languages, or conversely novel PL principles that improve upon
implementation and deployment of MMS.

We also want to critically examine what has worked, and what has not.
Why are all the languages of mainstream CA systems untyped? Why are the
(strongly typed) proof assistants so much harder to use than a typical
CAS? What forms of polymorphism exist in mathematics? What forms of
dependent types may be used in mathematical modeling? How can MMS
regain the upper hand on issues of "genericity" and "modularity"? What
are the biggest barriers to using a more mainstream language as a host
language for a CAS or PA/ATP?


Invited Talk


Conor McBride (Alta Systems, Northern Ireland) will give an invited
talk.


Submission
--

Submission works through EasyChair
http://www.easychair.org/conferences/?conf=plmms2008

Two kinds of papers will be considered:

* Full research papers may be up to 12 pages long. Authors of
  accepted papers are expected to present their work on the workshop
  in a regular talk.

* Position papers may be up to 4 pages long. The workshop
  presentation of accepted position papers consists of two parts: a
  stimulating statement of certain issues or challenges by the
  author, followed by a discussion in the plenum.

Papers should use the usual ENTCS style http://www.entcs.org/prelim.html
(11 point version), and will be reviewed by the program
committee. Informal workshop proceedings will be circulated as a
technical report.

Moreover there will be post-workshop proceedings of improved research
papers, or position paper

[Haskell-cafe] Job opening: Use Haskell to save the environment!

2008-03-05 Thread Ketil Malde

Well - maybe¹.  

I'm not sure how relevant this is for this list, but I thought I should
mention that there is an open position for a 3-year Ph.D. scolarship
at IMR where I work.  The work is in bioinformatics, and as I'm 
a happy Haskell user, I'd be happy to see qualified applicants who
know Haskell as well.

If you are interested, and posess a Master's degree (or equivalent
education), a rough translation of the announcement is attached - the
official one (in Norwegian) can be found at:
  http://www.imr.no/aktuelt/ledige_stillinger/stipendiat_bioinformatikk,

Please contact me with any questions!

-k


There is an open research fellow position (Ph.D. scholarship) at the
Institute of Marine Research in Bergen, Norway.  The position is for
three years, and it is part of the project "Salmon louse genome
sequencing and functional studies on host parasite interactions",
financed by the Norwegian Research Council's program for functional
genomics, FUGE. 

The sea louse is an important ecological and economic problem for the
fish farming industry, and the goal of the project is to investigate
parasite-host interactions, ultimately leading to a vaccine against
the sea louse.  

The research fellow will contribute to annotation and other analysis of
sequence data, establishing improved models for errors, and
development of new methods and software tools for computational
analysis.  New sequencing technologies are likely to be central.

We are looking for a motivated candidate with a relevant master's
degree or equivalent education, and a solid background in one of the
following topics:

 * algorithm development and analysis
 * statistics
 * bioinformatics
 * molecular biology

Place of work will be Bergen, the salary follows national regulations
and starts out at NOK 325000 (i.e., approximately €4)/year.

Contact Ketil Malde ([EMAIL PROTECTED], +47 55238647) for further
details. 

¹) The target of the project is the sea louse, which is a large
ecological and economical problem.
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Orphan instances

2008-03-05 Thread Simon Peyton-Jones
| GHC emits warning about orphan instance A (T t), since neither A nor T are
| defined in B. However I can't move the instance to A or T since it depends
| on B. Would it be fine to lift the restriction, such that it is accepted
| to declare the instance in a module where the type or the class or a
| superclass (this is new) is defined?

The issue is this.  Suppose GHC is compiling a module X, somewhere far away 
from the modules A,T,B which you define.  While compiling X, GHC needs to solve 
the class constraint
A (T Int)
Well, in order to make sense of the constraint, GHC will have read the 
interfaces for module A and T, so that it knows that A is indeed a class, and T 
is indeed a type constructor.

But so far nothing says that it needs to read the interface for B.  But suppose 
that B indeed appears in the transitive closure of X's imports.  Then the 
programmer expects GHC to find the instance in B.

To ensure that it does, GHC reads the interface of every orphan module in the 
transitive closure of X's imports.  (An orphan module is one like B that 
defines an instance whose head does not mention something defined locally.)  
The warning is just so that you know this is going to happen.  It's something 
to avoid when unnecessary, but not a bug.


I think you can see from this explanation that simply declaring that B isn't an 
orphan module after all isn't going to help!

Simon


| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Henning 
Thielemann
| Sent: 05 March 2008 06:53
| To: Haskell Cafe
| Subject: [Haskell-cafe] Orphan instances
|
|
| Consider the following modules
|
|
| module A
|
| class A t
|
|
| module T
|
| import A
|
| data T a
|
|
| module B
|
| import A
| import T
|
| class A t => B t
|
| instance B t => A (T t)
|
|
|
| GHC emits warning about orphan instance A (T t), since neither A nor T are
| defined in B. However I can't move the instance to A or T since it depends
| on B. Would it be fine to lift the restriction, such that it is accepted
| to declare the instance in a module where the type or the class or a
| superclass (this is new) is defined?
|
|
| In my example class B provides conversion toInteger (that is Integral),
| class A provides conversion toRational (that is Real) and T is Ratio.
| ___
| 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] Re: Exporting Haskell Libraries to C Programmers

2008-03-05 Thread Claude Heiland-Allen

Bruce, Joseph R (Joe) wrote:
[snip]

I hadn't looked at CABAL before.  It's a very useful tool and met all my 
library-forming needs.
That's only half my problem though.  I'm trying to make the use of this Haskell 
code as transparent as possible to the C programmers on the team.  Telling them 
about the Haskell base libraries dependency or distributing those libraries 
with my code is not too bad, but the list of -u flags that the linker needs is 
brutal.  Is there a way to avoid it, or embed it in the package?

Ex (using ghc-6.8.2 -v):
...
gcc -v -o primes Primes.o ./Primes_stub.o hs_primes_wrapper.o cprimes.c 


[snip]

Maybe try compiling cprimes.c to cprimes.o with gcc, then link with GHC?

Something like:

gcc -o cprimes.o -c cprimes.c
ghc -no-hs-main --make -c *.hs
ghc -no-hs-main -package foo -o moo *.o

I know this isn't ideal, but it's similar to what I used to build a .so 
from Haskell code that can be loaded by a C app ignorant of Haskell.



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


[Haskell-cafe] Re: ANN: Takusen 0.8

2008-03-05 Thread Alistair Bayley
>  Changes since 0.6:
>
>   - ODBC support. This still has a few gaps (and probably bugs and rough 
> edges)
>but should be fairly usable.

Doh!

I had also meant to make a request: the ODBC code (and Setup.hs
configuration) is only tested under Windows (XP). We'd love for people
to test on *nix platforms and fill in the missing bits in the Setup
script.

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


[Haskell-cafe] ANN: Takusen 0.8

2008-03-05 Thread Alistair Bayley
Oleg and I are pleased to announce the release of Takusen 0.8.

(Don Stewart did an interim 0.7 release for us a few weeks ago,
and added us to Hackage. This release is a tidy-up of some loose
ends, and some bug fixes. Hence, I've summarise the changes
since the 0.6 release.)


Changes since 0.6:

 - ODBC support. This still has a few gaps (and probably bugs and rough edges)
   but should be fairly usable.

 - support for reusable/persistent sessions, so you can hang onto
   the connection object between invocations of withSession
   (this was in release 0.6 but omitted from the release notes).

 - improvements to the Cabal Setup scripts, which should give
   better experiences for ghc-6.4, ghc-6.6, and ghc-6.8.
   The (eventual) 1.4 release of Cabal should be able to build our
haddock docs, too.

 - improved UTF8 decoder (marshals directly from buffer).


The release bundle:
  http://hackage.haskell.org/packages/archive/Takusen/0.8/Takusen-0.8.tar.gz
The latest code:
  darcs get http://darcs.haskell.org/takusen
Docs:
  http://darcs.haskell.org/takusen/doc/html/index.html

A comprehensive description of API usage can be found in the documentation
for module Database.Enumerator (look for the Usage section):
  http://darcs.haskell.org/takusen/doc/html/Database-Enumerator.html


Future plans:

 - FreeTDS backend (Sybase and MS Sql Server)

 - support for Blobs and Clobs


For those of you unfamiliar with Takusen, here is our HCAR blurb:

Takusen is a library for accessing DBMS's. Like HSQL, we support
arbitrary SQL statements (currently strings, extensible to anything
that can be converted to a string).

Takusen's `unique-selling-point' is safety and efficiency.
We statically ensure all acquired database resources - such
as cursors, connection and statement handles - are released, exactly
once, at predictable times. Takusen can avoid loading the whole result
set in memory, and so can handle queries returning millions of rows in
constant space. Takusen also supports automatic marshalling and
unmarshalling of results and query parameters. These benefits come
from the design of query result processing around a left-fold
enumerator.

Currently we fully support ODBC, Oracle, Sqlite, and PostgreSQL.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe