Re: [Haskell-cafe] GPL License of H-Matrix and prelude numeric

2011-01-27 Thread Ketil Malde
Chris Smith cdsm...@gmail.com writes:

 I disagree, I've always interpreted the license to cover the text in
 that particular package.

 There seems to be a difference in focus here that's confusing to me.
 When I write a library, my primary concern is generally with helping
 others use that library

I'm not saying it's a bad idea to echo the licensing of dependencies,
say for a library that wraps an underlying C-library.  But there could
be valid reasons for not doing it.

 As a result, if I were to write a package that depends on
 someone else's GPLed library, I don't see it being anywhere near worth
 the conceptual weight to apply a different license to the source code in
 the current package; since ultimately, the terms of the GPL are going to
 apply to anyone who builds a program with the library anyway.

What if the library depends on proprietary code?  Maybe you want to make
the code available for educational purposes, or porting to
non-proprietary alternatives?  What if you write a database access
library which links against various backends - just because one of the
backends has restriction (GPL, say), you may want to use a liberal
license so that people can still use it in their proprietary project
with (say) BSD-licensed back ends. 

 At any rate we need a different way to deal with this, since the
 license for the resulting binary can vary depending on build flags,
 different binaries from the same package can end up having different
 licensing, 

 The other (somewhat obvious, in my mind) possibility is to consider this
 a poor use of build flags 

Well, I disagree - it's nice to be able to ./configure --without-readline
(or whatever) precisely to avoid licensing conditions that are
unacceptable to your project.  The alternative is more duplication of
code.

 I suppose this is another reason to specify upper bounds on
 dependencies. :)  In this case, it's a matter of legal compatibility
 rather than technical compatibility, but it amounts to the same thing.

For most of us, technical compatibility is what's relevant, since we
typically download from Hackage and build everything from scratch, we
don't often redistribute binaries.

Linux distributions will have to audit packages a bit more carefully.

 That certainly seems like overkill.  First of all, as mentioned above,
 it's confusing and unnecessary to package things in such a way that
 different licenses will apply to different pieces or build options.

We have lots of itty bitty packages with a variety of licenses, so I'm
not sure this is so easy for non-trivial projects.

 Furthermore, the example above could be greatly shortened by just saying
 GPL. 

I'd be wary of automatically interpreting licensing issues for users.
Better to just provide the information, and let them decide whether they
have redistribution rights or not.

-k
-- 
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] Problem about exception

2011-01-27 Thread oleg

It seems that the problem is to follow a protocol, reporting protocol
errors (unexpected responses) and permitting recovery if the
`supervisor' decided that the error can be fixed by re-reading from
the server.

This problem -- specifically, communicating with a supervisor
`out-of-band' and recovery -- is a good use case for delimited
continuations.

The following code implements the scenario in Magicloud's
message. 
   http://okmij.org/ftp/continuations/CCmonad/ProtocolRecovery.hs

Actually, the code is interactive, letting the use play a
good or a bad server. One can see for themselves the effect of
expected or unexpected responses. The title comments show the examples
of good or bad interactions. Here is a sample transcript of several
interactions.



ProtocolRecovery main
Client Connected
sending: Req_hello
Enter response, as a number 1..4
1
sending: Req_who_are_you
Enter response, as a number 1..4
2
Client Dis-connected

ProtocolRecovery main
Client Connected
sending: Req_hello
Enter response, as a number 1..4
1
sending: Req_who_are_you
Enter response, as a number 1..4
3
Exception: Err_bad_resp Res_debug
DEBUG
Enter response, as a number 1..4
3
Exception: Err_bad_resp Res_debug
DEBUG
Enter response, as a number 1..4
2
Client Dis-connected

*ProtocolRecovery main
Client Connected
sending: Req_hello
Enter response, as a number 1..4
1
sending: Req_who_are_you
Enter response, as a number 1..4
4
Exception: Err_bad_resp Res_disconnect
Aborting
Client Dis-connected

*ProtocolRecovery main
Client Connected
sending: Req_hello
Enter response, as a number 1..4
1
sending: Req_who_are_you
Enter response, as a number 1..4
1
Exception: Err_bad_resp Res_hello
Really bad response!
Client Dis-connected

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


Re: [Haskell-cafe] Problem about exception

2011-01-27 Thread Magicloud Magiclouds
Thank you. I am looking into it.

On Thu, Jan 27, 2011 at 5:05 PM,  o...@okmij.org wrote:

 It seems that the problem is to follow a protocol, reporting protocol
 errors (unexpected responses) and permitting recovery if the
 `supervisor' decided that the error can be fixed by re-reading from
 the server.

 This problem -- specifically, communicating with a supervisor
 `out-of-band' and recovery -- is a good use case for delimited
 continuations.

 The following code implements the scenario in Magicloud's
 message.
   http://okmij.org/ftp/continuations/CCmonad/ProtocolRecovery.hs

 Actually, the code is interactive, letting the use play a
 good or a bad server. One can see for themselves the effect of
 expected or unexpected responses. The title comments show the examples
 of good or bad interactions. Here is a sample transcript of several
 interactions.



 ProtocolRecovery main
 Client Connected
 sending: Req_hello
 Enter response, as a number 1..4
 1
 sending: Req_who_are_you
 Enter response, as a number 1..4
 2
 Client Dis-connected

 ProtocolRecovery main
 Client Connected
 sending: Req_hello
 Enter response, as a number 1..4
 1
 sending: Req_who_are_you
 Enter response, as a number 1..4
 3
 Exception: Err_bad_resp Res_debug
 DEBUG
 Enter response, as a number 1..4
 3
 Exception: Err_bad_resp Res_debug
 DEBUG
 Enter response, as a number 1..4
 2
 Client Dis-connected

 *ProtocolRecovery main
 Client Connected
 sending: Req_hello
 Enter response, as a number 1..4
 1
 sending: Req_who_are_you
 Enter response, as a number 1..4
 4
 Exception: Err_bad_resp Res_disconnect
 Aborting
 Client Dis-connected

 *ProtocolRecovery main
 Client Connected
 sending: Req_hello
 Enter response, as a number 1..4
 1
 sending: Req_who_are_you
 Enter response, as a number 1..4
 1
 Exception: Err_bad_resp Res_hello
 Really bad response!
 Client Dis-connected




-- 
竹密岂妨流水过
山高哪阻野云飞

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


[Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread Chris Smith
So I find myself being asked to plan Haskell programming classes for one
hour, once a week, from September through May this coming school year.
The students will be ages 11 to 13.  I'm wondering if anyone has
experience in anything similar that they might share with me.  I'm
trying to decide if this is feasible, or it I should try to do something
different.

To be honest, as much as I love Haskell, I tried to push the idea of
learning a different language; perhaps Python.  So far, the kids will
have none of it!  This year, I've been teaching a once-a-week
exploratory mathematics sort of thing, and we've made heavy use of
GHCi... and they now insist on learning Haskell.

(By the way, GHCi is truly amazing for exploratory mathematics.  We
really ought to promote the idea of Haskell for elementary / junior-high
level math teachers!  It's so easy to just try stuff; and there are so
many patterns you can just discover and then say Huh, why do you think
that happens?  Can you write it down precisely? ...)

-- 
Chris Smith


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


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread aditya siram
Ye gods! A B  D [1] language for kids? At least give them a fighting
chance [2] at becoming future developers.

Haskell's immutability is good for mathematics but doing anything else
takes a great deal of up-front patience and perseverance, two very
rare qualities in that demographic if my own childhood is any
indication.

BTW I want to be wrong so if you do succeed with this I will feast on
crow with gusto.

-deech

[1] http://c2.com/cgi/wiki?BondageAndDisciplineLanguage
[2] http://scratch.mit.edu/

On Thu, Jan 27, 2011 at 9:04 AM, Chris Smith cdsm...@gmail.com wrote:
 So I find myself being asked to plan Haskell programming classes for one
 hour, once a week, from September through May this coming school year.
 The students will be ages 11 to 13.  I'm wondering if anyone has
 experience in anything similar that they might share with me.  I'm
 trying to decide if this is feasible, or it I should try to do something
 different.

 To be honest, as much as I love Haskell, I tried to push the idea of
 learning a different language; perhaps Python.  So far, the kids will
 have none of it!  This year, I've been teaching a once-a-week
 exploratory mathematics sort of thing, and we've made heavy use of
 GHCi... and they now insist on learning Haskell.

 (By the way, GHCi is truly amazing for exploratory mathematics.  We
 really ought to promote the idea of Haskell for elementary / junior-high
 level math teachers!  It's so easy to just try stuff; and there are so
 many patterns you can just discover and then say Huh, why do you think
 that happens?  Can you write it down precisely? ...)

 --
 Chris Smith


 ___
 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] Haskell for children? Any experience?

2011-01-27 Thread Dominique Devriese
Hi,

I'm also curious about this. Is a pure programming style like
Haskell's less or more natural than an imperative mutable-state based
one to kids without experience. I intuitively expect that for kids
with a high-school background in mathematics would find the first more
natural, but this is not based on any teaching experience. Does anyone
have real-life experience with this or know of any related literature?

Thanks
Dominique

2011/1/27 Vo Minh Thu not...@gmail.com:
 Hi,

 You said Haskell's immutability is good for mathematics but doing anything 
 else
 takes a great deal of up-front patience and perseverance[...]

 I guess it is true for imperative programmers... but are you saying
 that about kids that just know how to use a calculator?

 Cheers,
 Thu

 2011/1/27 aditya siram aditya.si...@gmail.com:
 Ye gods! A B  D [1] language for kids? At least give them a fighting
 chance [2] at becoming future developers.

 Haskell's immutability is good for mathematics but doing anything else
 takes a great deal of up-front patience and perseverance, two very
 rare qualities in that demographic if my own childhood is any
 indication.

 BTW I want to be wrong so if you do succeed with this I will feast on
 crow with gusto.

 -deech

 [1] http://c2.com/cgi/wiki?BondageAndDisciplineLanguage
 [2] http://scratch.mit.edu/

 On Thu, Jan 27, 2011 at 9:04 AM, Chris Smith cdsm...@gmail.com wrote:
 So I find myself being asked to plan Haskell programming classes for one
 hour, once a week, from September through May this coming school year.
 The students will be ages 11 to 13.  I'm wondering if anyone has
 experience in anything similar that they might share with me.  I'm
 trying to decide if this is feasible, or it I should try to do something
 different.

 To be honest, as much as I love Haskell, I tried to push the idea of
 learning a different language; perhaps Python.  So far, the kids will
 have none of it!  This year, I've been teaching a once-a-week
 exploratory mathematics sort of thing, and we've made heavy use of
 GHCi... and they now insist on learning Haskell.

 (By the way, GHCi is truly amazing for exploratory mathematics.  We
 really ought to promote the idea of Haskell for elementary / junior-high
 level math teachers!  It's so easy to just try stuff; and there are so
 many patterns you can just discover and then say Huh, why do you think
 that happens?  Can you write it down precisely? ...)

 --
 Chris Smith


 ___
 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


 ___
 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] Haskell for children? Any experience?

2011-01-27 Thread Chris Smith
On Thu, 2011-01-27 at 15:26 +, Stephen Tetley wrote:
 John Peterson had some nice work using Haskore and Fran for elementary
 teaching on the old Haskell.org website. Google's cache says the old
 URL was here but its now vanished:
 
 www.haskell.org/edsl/campy/campy-2003-music.ppt

That sounds great!  If you do have an existing copy of the slides, I'd
like to see them.  Especially the idea of using music for programming
with a nice embedded DSL / combinator library would be amazing.

-- 
Chris


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


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread Henk-Jan van Tuyl
On Thu, 27 Jan 2011 16:26:01 +0100, Stephen Tetley  
stephen.tet...@gmail.com wrote:



On 27 January 2011 15:04, Chris Smith cdsm...@gmail.com wrote:
[SNIP]

I'm wondering if anyone has
experience in anything similar that they might share with me.  I'm
trying to decide if this is feasible, or it I should try to do something
different.


Hi Chris

John Peterson had some nice work using Haskore and Fran for elementary
teaching on the old Haskell.org website. Google's cache says the old
URL was here but its now vanished:

www.haskell.org/edsl/campy/campy-2003-music.ppt

I've copies of the slides somewhere but the landing page had extra
notes and examples. I can send you the slides off-list if you want
them.


The old server is still up till the end of this month (four days to go!);  
the URL of the landing page is:

  http://oldhaskell.cs.yale.edu/edsl/

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--

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


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread Niklas Broberg
 Ye gods! A B  D [1] language for kids? At least give them a fighting
 chance [2] at becoming future developers.

 Haskell's immutability is good for mathematics but doing anything else
 takes a great deal of up-front patience and perseverance, two very
 rare qualities in that demographic if my own childhood is any
 indication.

Begone, disbeliever! And listen to the gospel of Matthias Felleisen
preaching the truth: http://vimeo.com/6631514 (presentation from ICFP
2009)

The paper is A Functional I/O System - or, Fun for Freshman Kids:
http://www.ccs.neu.edu/scheme/pubs/icfp09-fffk.pdf

Alas, it's about Scheme, but I am sure it would be both interesting
and useful regardless.

Cheers,

/Niklas

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


[Haskell-cafe] Building a shared library with FFI on x86_64

2011-01-27 Thread Eric Webster
I have a project that involves building a shared library containing code 
generated by GHC and exposed using the foreign function interface to 
other C programs that link against it. I'm able to build a functioning 
library without issue on 32bit x86 systems using GHC 6.8.2 and 6.12.3. 
When I try to build on a 64bit x86 system I get a relocation error that 
advises I include -fPIC. Including -fPIC does not help though. I'm 
wondering if I'm either doing something wrong or if this could be a 
problem with GHC.


I've created and attached a small example that illustrates this issue.

When building on 64bit x86 with GHC 7.0.1 and -fPIC and -dynamic I get 
the following error. (Similar with GHC 6.12.3)
/usr/bin/ld: CLibrary.o: relocation R_X86_64_PC32 against 
`CLibrary_testFunctionCWrapper_srt' can not be used when making a shared 
object; recompile with -fPIC

/usr/bin/ld: final link failed: Bad value

When building on 64bit x86 with GHC 7.0.1 and -fPIC and without -dynamic 
I get the following error (Similar with GHC 6.12.3 and 6.8.2)
/usr/bin/ld: 
/home/CIRG/ew/local/lib/ghc-7.0.1/base-4.3.0.0/libHSbase-4.3.0.0.a(Base__1.o): 
relocation R_X86_64_32S against `a local symbol' can not be used when 
making a shared object; recompile with -fPIC
/home/CIRG/ew/local/lib/ghc-7.0.1/base-4.3.0.0/libHSbase-4.3.0.0.a: 
could not read symbols: Bad value


When building on 32bit x86 with GHC 6.12.3 I get no error regardless of 
-fPIC or -dynamic.
When building on 32bit x86 with GHC 6.8.2 I get no error regardless of 
-fPIC and without -dynamic.


Any advice would be appreciated! Thanks.

module CLibrary where

import Foreign.C.Types
import Foreign.C.String
import Foreign.Marshal.Alloc
import Foreign.Marshal.Array
import Foreign.Ptr
import Foreign.Storable

foreign export ccall testFunction testFunctionCWrapper :: CString - IO (Ptr 
CString)

testFunctionCWrapper :: CString - IO (Ptr CString)
testFunctionCWrapper cs = do
  input - peekCString cs
  output1 - newCString hello world
  output2 - newCString input
  newArray [output1, output2]

LIB=test.so
OPTIONS=-fPIC -XForeignFunctionInterface -no-hs-main -optl -shared -rdynamic
#OPTIONS=-dynamic -fPIC -XForeignFunctionInterface -no-hs-main -optl -shared 
-rdynamic

GHC=ghc
#GHC=/home/CIRG/ew/local/bin/ghc

all:
$(GHC) $(OPTIONS) --make CLibrary -o $(LIB)

clean:
rm -rf *.hi *.o CLibrary_stub.c CLibrary_stub.h

pretty: clean
rm -rf *~ $(LIB)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Call for Copy: Monad.Reader Issue 18

2011-01-27 Thread Brent Yorgey
Whether you're an established academic or have only just started
learning Haskell, if you have something to say, please consider
writing an article for The Monad.Reader! The submission deadline
for Issue 18 will be:

**Friday, April 1, 2011**

This will be a normal issue -- but don't forget to also submit your
Haskell poems and short stories by February 18 for inclusion in the
special poetry and fiction edition [1]!


The Monad.Reader


The Monad.Reader is a electronic magazine about all things Haskell.
It is less formal than journal, but somehow more enduring than a
wiki-page. There have been a wide variety of articles: exciting
code fragments, intriguing puzzles, book reviews, tutorials, and
even half-baked research ideas.

Submission Details
~~

Get in touch with me if you intend to submit something -- the
sooner you let me know what you're up to, the better.

Please submit articles for the next issue to me by e-mail (byorgey
at cis.upenn.edu).

Articles should be written according to the guidelines available
from

http://themonadreader.wordpress.com/contributing/

Please submit your article in PDF, together with any source files
you used. The sources will be released together with the magazine
under a BSD license.

If you would like to submit an article, but have trouble with LaTeX
please let me know and we'll work something out.


[1] 
http://themonadreader.wordpress.com/2011/01/19/call-for-copy-special-poetry-and-fiction-edition/

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


Re: [Haskell-cafe] Building a shared library with FFI on x86_64

2011-01-27 Thread Eric Webster
Thanks to http://www.well-typed.com/blog/30 I was able to figure out 
what I was doing wrong. Replacing -optl -shared with just -shared 
and using -dynamic allows linking to complete. :D



On 2011-01-27 11:59 AM, Eric Webster wrote:
I have a project that involves building a shared library containing 
code generated by GHC and exposed using the foreign function interface 
to other C programs that link against it. I'm able to build a 
functioning library without issue on 32bit x86 systems using GHC 6.8.2 
and 6.12.3. When I try to build on a 64bit x86 system I get a 
relocation error that advises I include -fPIC. Including -fPIC does 
not help though. I'm wondering if I'm either doing something wrong or 
if this could be a problem with GHC.


I've created and attached a small example that illustrates this issue.

When building on 64bit x86 with GHC 7.0.1 and -fPIC and -dynamic I get 
the following error. (Similar with GHC 6.12.3)
/usr/bin/ld: CLibrary.o: relocation R_X86_64_PC32 against 
`CLibrary_testFunctionCWrapper_srt' can not be used when making a 
shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Bad value

When building on 64bit x86 with GHC 7.0.1 and -fPIC and without 
-dynamic I get the following error (Similar with GHC 6.12.3 and 6.8.2)
/usr/bin/ld: 
/home/CIRG/ew/local/lib/ghc-7.0.1/base-4.3.0.0/libHSbase-4.3.0.0.a(Base__1.o): 
relocation R_X86_64_32S against `a local symbol' can not be used when 
making a shared object; recompile with -fPIC
/home/CIRG/ew/local/lib/ghc-7.0.1/base-4.3.0.0/libHSbase-4.3.0.0.a: 
could not read symbols: Bad value


When building on 32bit x86 with GHC 6.12.3 I get no error regardless 
of -fPIC or -dynamic.
When building on 32bit x86 with GHC 6.8.2 I get no error regardless of 
-fPIC and without -dynamic.


Any advice would be appreciated! Thanks.



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


[Haskell-cafe] A few days to go before the old server goes down

2011-01-27 Thread Henk-Jan van Tuyl


L.S.,

Only four days until the old Haskell.org server disappears; I found the  
following missing:


http://www.haskell.org/yale/
http://darcs.haskell.org/hfuse/
http://haskell.org/gtk2hs/
http://haskell.org/FranTk
http://www.haskell.org/yampa/
http://www.haskell.org/visualhaskell/

http://haskell.org/~kolmodin
http://haskell.org/graphics/
http://www.haskell.org/libraries/
http://haskell.org/hdirect/
http://haskell.org/haskore/
http://darcs.haskell.org/wxhaskell/
http://www.haskell.org/all_about_monads
http://www.haskell.org/edsl/
http://www.haskell.org/jcp/
http://darcs.haskell.org/yaht
http://cvs.haskell.org/darcs/
http://haskell.org/ObjectIO
http://www.haskell.org/sitewiki/
http://darcs.haskell.org/~lemmih/

It would also be a shame if useful information would be lost, so copy the  
pages before it is too late! (The Wayback Machine has no recent copies, or  
even none at all for some pages.)


If they have moved, it would be useful to know whereto, as several  
HaskellWiki pages have to be updated.


Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--

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


Re: [Haskell-cafe] Haskell for children? Any experience?

2011-01-27 Thread Chris Smith
On Thu, 2011-01-27 at 16:40 +0100, klondike wrote:
 Two days ago I was referred to this project:
 http://wizbang.sourceforge.net/WizBang/WizBang.html The language is
 quite imperative but to me looks as a child friendly programming
 language due to its low complexity.

Thanks for this and other related suggestions.  Really, though, I'm not
looking to find a new language; and almost surely not one like WizBang.
I do want to keep things light, interesting, and fun... a DSL inside of
Haskell might be interesting.  But the absolute last message I want to
send is that I don't think they are ready for a real language.  Not
after they've already played with Haskell and GHCi for mathematics!

-- 
Chris Smith



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


Re: [Haskell-cafe] tricky recursive type instance method

2011-01-27 Thread Antoine Latter
On Thu, Jan 27, 2011 at 9:35 PM, Frank Kuehnel vince...@mac.com wrote:
 Hi folks,

 how do I make this work: I want a division algebra over a field k, and I want 
 to define
 the conjugation of complex numbers, i.e. conj (C 1 2) but also the 
 conjugation of tensors of complex numbers
 conj (C (C 1 2) (C 1 4))

 ghci load that stuff butt barfs on a simple
 conj (C 1 2)

 with
      instance Real a = DAlgebra a a -- Defined at Clifford.hs:20:10-31
      instance (Real r, Num a, DAlgebra a r) = DAlgebra (Complex a) r


 here's the code:

 -- for a normed division algebra we need a norm and conjugation!
 class DAlgebra a k | a - k where -- need functional dependence because conj 
 doesn't refer to k
   conj :: a - a
   abs2 :: a - k

 -- real numbers are a division algebra
 instance Real a = DAlgebra a a where
   conj    = id
   abs2 x  = x*x

 -- Complex numbers form a normed commutative division algebra
 data Complex a = C a a deriving (Eq,Show)

 instance Num a = Num (Complex a) where
   fromInteger a = C (fromInteger a) 0
   (C a b)+(C a' b') = C (a+a') (b+b')
   (C a b)-(C a' b') = C (a-a') (b-b')
   (C a b)*(C a' b') = C (a*a'-b*b') (a*b'+b*a')

 instance (Real r, Num a, DAlgebra a r) = DAlgebra (Complex a) r where
   conj (C a b)    = C a (conj (-b))
   abs2 (C a b)    = (abs2 a) + (abs2 b)



What error are you getting in GHCi? It wasn't immediately clear from
your email, but maybe I missed it.

It looks like you have overlapping instances between `DAlgebra a a`
and `DAlgebra (Complex a) r`, so if that's what you want you'll need
to making sure you have the OverlappingInstances extension turned on.

You might run in to other issues further on.

Antoine


 Thanks for you help!

 ___
 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] Haskell for children? Any experience?

2011-01-27 Thread Chris Smith
On Thu, 2011-01-27 at 09:28 -0600, aditya siram wrote:
 Ye gods! A B  D [1] language for kids?

I do share those concerns.  Like I said in the original post, my initial
reaction was to push for something like Python.  But the kids are very
clear; if I'm at all willing, they want to learn Haskell!  And honestly,
I'd like to try it too, *if* I can do my due diligence research, and pay
attention to others who might have tried and learned some lessons along
the way!

 At least give them a fighting chance [2] at becoming future developers.
 [2] http://scratch.mit.edu/

Thanks for that suggestion; unfortunately, much like the WizBang
suggestion, Scratch is going to come across as if, for some reason,
after happily using GHCi for math, I now don't trust them with a real
programming language.  I can guarantee you they won't be interested in
programming by dragging around brightly colored things that look like
puzzle pieces on the screen; and I can't imagine keeping it up for the
whole year even if they were interested.

-- 
Chris


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


Re: [Haskell-cafe] Cabal proxy configuration

2011-01-27 Thread Azeem -ul-Hasan


Please explain this a bit. Where are the configuration files for cabal install. 
I tried to enter the line in the terminal and it apparently it accepted i.e 
gave no error but then running cabal update results in this error 
No action for prompting/generating user+password credentials  provided (use: 
setAuthorityGen); returning Nothing
cabal: Failed to download index 'ErrorMisc Unsucessful HTTP code: (4,0,7)'
This is the first time I am using cabal so I am almost completely blank for it.
Thanks
Azeem
 Date: Fri, 28 Jan 2011 15:26:08 +1000
 Subject: Re: [Haskell-cafe] Cabal proxy configuration
 From: ivan.miljeno...@gmail.com
 To: aze...@live.com
 CC: haskell-cafe@haskell.org
 
 On 28 January 2011 15:13, Azeem -ul-Hasan aze...@live.com wrote:
  My university requires the students to use internet through an authenticated
  http proxy. How do I configure cabal for that? I am using Ubuntu. Please be
  detailed about it.
 
 Do you mean Cabal or cabal-install?
 
 Assuming the latter:
 
 export http_proxy=http://${username}:${password}@${proxy_address}
 
 -- 
 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] Cabal proxy configuration

2011-01-27 Thread Ivan Lazar Miljenovic
On 28 January 2011 16:00, Azeem -ul-Hasan aze...@live.com wrote:

 Please explain this a bit. Where are the configuration files for cabal
 install.

cabal-install is configured in ~/.cabal/config

However, as far as I'm aware it uses normal http connections and
doesn't require any particular configuration for proxies: it just uses
the system settings.

For example: 
http://serverfault.com/questions/132640/ubuntu-set-system-proxy-from-command-line

-- 
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