Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Galchin, Vasili
based on ghc-pkg list 

in my global ghc install I have bytestring-0.9.0.1

in my local ghc install I have bytestring-0.9.1.0

this difference of versions I strongly think is causing my problems..

When I run cabal install bytestring from the CLI, I get resolving
differences 

If my assertion that the delta between the global vs local is causing
my compile problems, then what should I do??

Regards, Vasili


On Wed, Dec 3, 2008 at 1:52 AM, Galchin, Vasili [EMAIL PROTECTED] wrote:

 Warning: This package indirectly depends on multiple versions of the same
 package. This is highly likely to cause a compile failure.
 package binary-0.4.2 requires bytestring-0.9.0.1
 package bio-0.3.4.1 requires bytestring-0.9.1.0


 ah ha .. Ketil, this is what you are saying? If so, how do I fix? install a
 newer version of binary?

 regards, vasili

 On Wed, Dec 3, 2008 at 1:32 AM, Ketil Malde [EMAIL PROTECTED] wrote:

 Galchin, Vasili [EMAIL PROTECTED] writes:

  I think I am getting a namespace collition between
 
Data.ByteString.Lazy.Char8.ByteString
 
  and
 
   Data.ByteString.Lazy.Internal.ByteString 

 You rarely need to import 'Internal' directly.

  here is the error message 
 
  Couldn't match expected type `B.ByteString'
 against inferred type
  `bytestring-0.9.0.1:Data.ByteString.Lazy.Internal.ByteString'

 Are you sure this is not just a versioning problem?  I.e. that some
 library is built against bytestring-0.X.Y, but your current import is
 bytestring-0.A.B, but your program expects these to be the same?  (And
 they probably are, but the compiler can't really tell).

 -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] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Ketil Malde
Galchin, Vasili [EMAIL PROTECTED] writes:

 Warning: This package indirectly depends on multiple versions of the same
 package. This is highly likely to cause a compile failure.
 package binary-0.4.2 requires bytestring-0.9.0.1
 package bio-0.3.4.1 requires bytestring-0.9.1.0

 ah ha .. Ketil, this is what you are saying? 

Yes, exactly.

 If so, how do I fix? install a newer version of binary?

Just recompiling it against bytestring-0.9.1.0 would suffice.
You really should anyway, bytestring-0.9.0.1 has a nasty performance
issue.

-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


[Haskell-cafe] Re: Fun with type functions

2008-12-03 Thread Ashley Yakeley

Simon Peyton-Jones wrote:


can you tell us about the most persuasive, fun application
you've encountered, for type families or functional dependencies?


I'm using them to provide witnesses to lenses.

Given two lenses on the same base type, I want to compare them, and if 
they're the same lens, know that they have the same view type.


  data Lens base view = MkLens
  {
-- lensWitness :: ???,
lensGet :: base - view,
lensPut :: base - view - base
  };

How do I compare Lens base view1 and Lens base view2, and match up 
view1 and view2?


The difficulty is that my witnesses are monomorphic, while a lens may be 
polymorphic. For instance, the lens corresponding to the fst function:


  fstLens :: Lens (a,b) a;
  fstLens = MkLens
  {
lensGet = fst,
lensPut = \(_,b) a - (a,b)
  };

I only want to generate one open witness for fstLens, but what is its type?

This is where type functions come in. I have a type family TF, and a 
basic set of instances:


  type family TF tf x;

  data TFIdentity;
  type instance TF TFIdentity x = x;

  data TFConst a;
  type instance TF (TFConst a) x = a;

  data TFApply (f :: * - *);
  type instance TF (TFApply f) x = f x;

  data TFMatch;
  type instance TF TFMatch (f a) = a;

  data TFMatch1;
  type instance TF TFMatch1 (f a b) = a;

  data TFCompose tf1 tf2;
  type instance TF (TFCompose tf1 tf2) x = TF tf1 (TF tf2 x);

I create a new witness type, that witnesses type functions:

  import Data.Witness;

  data TFWitness w x y where
  {
MkTFWitness :: w tf - TFWitness w x (TF tf x);
  };

  instance (SimpleWitness w) = SimpleWitness (TFWitness w x) where
  {
matchWitness (MkTFWitness wtf1) (MkTFWitness wtf2) = do
{
  MkEqualType - matchWitness wtf1 wtf2;
  return MkEqualType;
};
  };

So for my lens type, I want a witness for the type function from base to 
view:


  data Lens base view = MkLens
  {
lensWitness :: TFWitness IOWitness base view,
lensGet :: base - view,
lensPut :: base - view - base
  };

For our fst lens, I can now generate a witness for the function from 
(a,b) to a.


  fstWitness :: IOWitness TFMatch1;
  fstWitness - newIOWitness; -- language extension

  fstLens :: Lens (a,b) a;
  fstLens = MkLens
  {
lensWitness = MkTFWitness fstWitness,
lensGet = fst,
lensPut = \(_,b) a - (a,b)
  };

I can now compare two lenses like this:

  get1put2 :: Lens base view1 - Lens base view2 - base - Maybe base;
  get1put2 lens1 lens2 b = do
  {
MkEqualType - matchWitness (lensWitness lens1) (lensWitness lens2);
return (lensPut lens2 b (lensGet lens1 b));
  };

(Actually, I'm doing something a bit more useful than get1put2.)

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


Re: [Haskell-cafe] What causes loop?

2008-12-03 Thread Janis Voigtlaender

Martin Hofmann wrote:

I've already posted this mail on haskell-cafe, but apparently the
subject suggested a too simple question, so I try it here again. I am
picking up a discussion with the same topic from haskell-users on
8th November. 


Note that you have been sending to haskell-cafe again. Your recipient
name says haskell-beginners, but the address is haskell-cafe.

Anyway, loop really means a loop in evalutation order, not some
statebased deadlock (see below).


Thunks with reference on themselves was mentioned as main reason for
loop.



A safe recursive definition would be
 let x = Foo (x+1)
However, if you leave out the constructor,
 let x = x + 1
you get a loop (or a deadlock).




Are there any other reasons? 


I am trying to debug monadic code which stores state information in a
record maintaining several Data.Maps, but in vain so far. A state is
modified/changed in several steps by a compound function i.e.

changeA $ changeB $ changeC state

Could this also lead to a deadlock? 


I don't think so. At least not in a way that leads to loop. If you
get loop then you really have some infinite recursion in your
program. Maybe you can track it down with Debug.Trace.trace.
If so, can I prevent this using CPS?

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] What causes loop?

2008-12-03 Thread Janis Voigtlaender

Janis Voigtlaender wrote:

Martin Hofmann wrote:


I've already posted this mail on haskell-cafe, but apparently the
subject suggested a too simple question, so I try it here again. I am
picking up a discussion with the same topic from haskell-users on
8th November. 



Note that you have been sending to haskell-cafe again. Your recipient
name says haskell-beginners, but the address is haskell-cafe.

Anyway, loop really means a loop in evalutation order, not some
statebased deadlock (see below).


Thunks with reference on themselves was mentioned as main reason for
loop.



A safe recursive definition would be
 let x = Foo (x+1)
However, if you leave out the constructor,
 let x = x + 1
you get a loop (or a deadlock).




Are there any other reasons?
I am trying to debug monadic code which stores state information in a
record maintaining several Data.Maps, but in vain so far. A state is
modified/changed in several steps by a compound function i.e.

changeA $ changeB $ changeC state

Could this also lead to a deadlock? 



I don't think so. At least not in a way that leads to loop. If you
get loop then you really have some infinite recursion in your
program. Maybe you can track it down with Debug.Trace.trace.
If so, can I prevent this using CPS?


Oh, that last question was from the original mail, not from my answer.
In any case, I don't think that CPS will help in finding the looping
error in your program.

--
Dr. Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
Good morning,
I wonder if it is possible to embed regular HTML code inside gitit (on
0.3.2) pages, such as java applets like the following.

APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100 HEIGHT = 400
ALT = you should see an instance of GHood here, as an applet PARAM NAME
= eventSource VALUE =factHylo.log PARAM NAME = delay VALUE =150
PARAM NAME = scale VALUE =75 /APPLET

I am assuming that as a wiki, it is only possible to point to external
pages.

Thanks,
hugo


On Sun, Nov 9, 2008 at 10:01 PM, Chris Eidhof [EMAIL PROTECTED] wrote:

 If anyone else has problems installing gitit, try updating your
 cabal-install (and cabal). I had old versions on my computer, and updating
 them solved my gitit build-problems.

 -chris


 On 9 nov 2008, at 22:41, John MacFarlane wrote:

  I've just uploaded a new version (0.2.1) that requires HAppS = 0.9.3 
  0.9.4. (There are small API changes from 0.9.2 to 0.9.3, so I thought
 it best not to allow 0.9.2.x, even though it still compiles with a
 warning.)

 +++ Hugo Pacheco [Nov 09 08 20:41 ]:

  a new HAppS version [1]0.9.3.1 has been released, and gitit requires
  HApps==[2]0.9.2.1. should ti be ok just to relax the dependency?

  On Sat, Nov 8, 2008 at 8:32 PM, John MacFarlane [EMAIL PROTECTED]
  wrote:

I've uploaded an early version of gitit, a Haskell wiki program, to
HackageDB. Gitit uses HAppS as a webserver, git for file storage,
pandoc for rendering the (markdown) pages, and highlighting-kate for
highlighted source code.

Some nice features of gitit:

 - Pages and uploaded files are stored in a git repository and may
   be added, deleted, and modified directly using git.
 - Pages may be organized into subdirectories.
 - Pandoc's extended version of markdown is used, so you can do
 tables,
   footnotes, syntax-highlighted code blocks, and LaTeX math. (And
   you can you pandoc to convert pages into many other formats.)
 - Math is rendered using jsMath (which must be installed
   separately).
 - Source code files in the repository are automatically rendered with
   syntax highlighting (plain/text version is also available).

You can check it out on my webserver: [4]
 http://johnmacfarlane.net:5001/
Or try it locally:

   cabal update
   cabal install pandoc -fhighlighting
   cabal install gitit
   gitit  # note: this will create two subdirectories in the working
directory
   # then browse to [5]http://localhost:5001.

There's a git repository at [6]
 http://github.com/jgm/gitit/tree/master.
Comments and patches are welcome.

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

  --
  [9]www.di.uminho.pt/~hpacheco

 References

  Visible links
  1. http://0.9.3.1/
  2. http://0.9.2.1/
  3. mailto:[EMAIL PROTECTED]
  4. http://johnmacfarlane.net:5001/
  5. http://localhost:5001/
  6. http://github.com/jgm/gitit/tree/master
  7. mailto:Haskell-Cafe@haskell.org
  8. http://www.haskell.org/mailman/listinfo/haskell-cafe
  9. http://www.di.uminho.pt/~hpacheco


  ___
 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




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cabal and Hat?

2008-12-03 Thread Magnus Therning
Is it possible to use cabal to build the files that hat would need to
do tracing (i.e. .htx files)?

/M

-- 
Magnus Therning(OpenPGP: 0xAB4DFBA4)
magnus@therning.org  Jabber: magnus@therning.org
http://therning.org/magnus identi.ca|twitter: magthe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: What causes loop?

2008-12-03 Thread Apfelmus, Heinrich
Martin Hofmann wrote:
 Thunks with reference on themselves was mentioned as main reason for
 loop.
 
 A safe recursive definition would be
   let x = Foo (x+1)
 However, if you leave out the constructor,
   let x = x + 1
 you get a loop (or a deadlock).

 
 Are there any other reasons? 

A program that exits with loop is basically a program that runs
forever. Examples of programs that run forever are

  let x = x + 1 in x

  let f x = f x in f 1

In special cases, the run-time system is able to detect that the program
would run forever, and exits with loop if that happens.

 Sorry, a lot of questions at once, but I am kind of helpless because I
 can't find any reason of my loop, so any comments, experience, and
 tips are highly appreciated.

Sometimes, a simple cause is accidentally using the same variable name,
i.e. writing

  let (c,s) = foobar s in ...

while you meant

  let (c,s') = foobar s in ...


At other times, non-termination is caused by not using enough
irrefutable patterns. But this usually only happens when writing
algorithms that heavily exploit recursion and laziness, which probably
doesn't apply to your case.


You may want to try the new GHCi debugger, maybe it helps finding the loop.


Regards,
H. Apfelmus

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


[Haskell-cafe] Re: What causes loop?

2008-12-03 Thread Martin Hofmann
I was not sure about it, so I just speculated. 

Anyway, thanks a lot.

martin

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


Re: [Haskell-cafe] Data.ByteString vs Data.ByteString.Lazy vs Data.ByteString.Char8

2008-12-03 Thread Duncan Coutts
On Wed, 2008-12-03 at 01:52 -0600, Galchin, Vasili wrote:
 Warning: This package indirectly depends on multiple versions of the
 same
 package. This is highly likely to cause a compile failure.
 package binary-0.4.2 requires bytestring-0.9.0.1
 package bio-0.3.4.1 requires bytestring-0.9.1.0
 
 
 ah ha .. Ketil, this is what you are saying? If so, how do I fix?
 install a newer version of binary?

This is the most significant issue that cabal-install addresses. It
works out what needs to be rebuilt to get consistent dependencies.

In this example you could run:

$ cabal install --dry-run

in the directory containing your package and it will say what it would
install or re-install to be able to build your package. If you drop the
--dry-run then it will actually do it, including installing your
package.

Duncan

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


Re: [Haskell-cafe] ByteString web site papers

2008-12-03 Thread Duncan Coutts
On Tue, 2008-12-02 at 22:56 -0600, Galchin, Vasili wrote:
 Hello,
 
 http://www.cse.unsw.edu.au/~dons/fps.html 
 
 Are the papers/slides still up-to-date for someone to get up-to-speed
 on ByteString motivation and implementation? 

Yes.

 Anything more recent?

It links to the stream fusion paper but that's more about lists than
bytestrings.

Duncan

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


Re: [Haskell-cafe] Cabal and Hat?

2008-12-03 Thread Duncan Coutts
On Wed, 2008-12-03 at 09:36 +, Magnus Therning wrote:
 Is it possible to use cabal to build the files that hat would need to
 do tracing (i.e. .htx files)?

No, but if you'd like to add support that'd be a great service to
everyone.

Duncan

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


Re: [Haskell-cafe] Problem building HXQ on Mac OS 10.5.5

2008-12-03 Thread Tobias Kräntzer

Hi,

Am 03.12.2008 um 02:00 schrieb Gwern Branwen:

I haven't looked at the source, so take this as off-the-cuff: try
importing not Control.Exception but Control.OldException.


changing Control.Exceptionto Control.OldException didn't work. But  
changing SomeException to Exception seems to solve the problem  
(see below). At least I can now built it and use xquery.


I think these days I get more in to it and understand what I was  
doing. ;-)
Could it be a problem with the version of GHC? I'm using 6.10.1. Is  
SomeException still supported? At the moment I don't know how to  
look these things up.


Regard,
. . . Tobias

--
Original:
#if __GLASGOW_HASKELL__ = 609
type E = C.SomeException
#else
type E = C.Exception
#endif

--
Modified:
type E = C.Exception

--
Tobias Kräntzer | Scharnweberstraße 52a | 10247 Berlin
Telefon: +49-30-75636668 | +49-178-1353136
XMPP: [EMAIL PROTECTED]

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


[Haskell-cafe] handles and foreign C functions

2008-12-03 Thread Andrea Rossato
Hello,

suppose a simple C function like this:

void printStuff(FILE *f)
{
fprintf (f, Hello World\n);
}

In order to use it I need to import fopen and pass to it a Ptr CFile:

foreign import ccall unsafe fopen  fopen  :: CString - CString - IO (Ptr 
CFile)
foreign import ccall unsafe fclose fclose :: Ptr CFile - IO CInt

foreign import ccall unsafe printStuff printStuff :: Ptr CFile - IO ()

main =
  withCString tmp.txt $ \cpath  -
  withCString w   $ \cmode  - do
cfile - throwErrnoIfNull fopen:  (fopen cpath cmode)
printStuff cfile
fclose cfile

How can I pass to printStuff a stdout FILE pointer?

If, for instance, I do:

foreign import ccall unsafe stdout c_stdout :: Ptr CFile
main =
  withCString tmp.txt $ \cpath  -
  withCString w   $ \cmode  - do
printStuff c_stdout

I get a segmentation fault.

What am I missing?

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


[Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Lionel Barret De Nazaris
I've just discovered the GMP license problem. (see 
http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes)


From my understanding, the gmp is GPL, GHC statically links it on windows.
As a consequence, any program compiled using GHC must be distributed 
under a GPL compatible license.


In the threads I've read, some workarounds are proposed on linux and 
OsX, but I didn't see anything on windows.


Is the situation still the same  ?
Does anybody know a work-around to make a closed-source programm in 
haskell without violating the GPL ?


( Note this could block Haskell in our company. )

--
Best Regards,
lionel Barret de Nazaris,
=
Gamr7 : Cities for Games
http://www.gamr7.com




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


Re: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Don Stewart
lionel:
 I've just discovered the GMP license problem. (see 
 http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes)
 
 From my understanding, the gmp is GPL, GHC statically links it on windows.
 As a consequence, any program compiled using GHC must be distributed 
 under a GPL compatible license.

GMP is *LGPL*.
  
 In the threads I've read, some workarounds are proposed on linux and 
 OsX, but I didn't see anything on windows.
 
 Is the situation still the same  ?
 Does anybody know a work-around to make a closed-source programm in 
 haskell without violating the GPL ?

It is LGPL, which is a very important distinction. It just must be
possible to replace the libgmp component with another that has been
modified - you can't actively prevent people replacing the libgmp
component.

Supporting this is trivial with a dynamically linked / DLL libgmp. With
a statically linked  one, it is also possible, since the API calls to
libgmp are specified.

This shouldn't prevent commercial use -- lots of other companies have
decided this is OK. You just need to be aware of it.

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


Re: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Jonathan Cast
On Wed, 2008-12-03 at 15:36 +0100, Lionel Barret De Nazaris wrote:
 I've just discovered the GMP license problem. (see 
 http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes)
 
  From my understanding, the gmp is GPL, GHC statically links it on
 windows.

Lesser GPL: http://www.gnu.org/copyleft/lesser.html

It doesn't actually have a section 2(c) as per the wiki.  Section 4(d)0
of the LGPL is traditionally taken to allow static linking, as long as
you distribute

a) The source of the version of GMP you use (corresponding source), and
b) Object files/libraries for your program + the GHC RTS suitable for
static linking with your user's (possibly modified) builds of the
distributed GMP source.

jcc


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


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread John MacFarlane
+++ Hugo Pacheco [Dec 03 08 09:36 ]:
Good morning,
I wonder if it is possible to embed regular HTML code inside gitit (on
0.3.2) pages, such as java applets like the following.
APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100 HEIGHT =
400 ALT = you should see an instance of GHood here, as an applet PARAM
NAME = eventSource VALUE =factHylo.log PARAM NAME = delay VALUE
=150 PARAM NAME = scale VALUE =75 /APPLET
I am assuming that as a wiki, it is only possible to point to external
pages.
Thanks,
hugo

Of course you can put any HTML you like in the page template
(template.html).  But I assume you are asking about HTML inside the wiki
pages themselves. Although markdown allows embedded HTML, gitit uses pandoc's
HTML sanitization feature, so things that might be dangerous (like
applets) will be filtered out and replaced by comments.

You could easily modify the code to remove the santitization feature.
Just change the textToPandoc function so that stateSanitizeHtml is set to
False.

John

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


Re: [Haskell-cafe] handles and foreign C functions

2008-12-03 Thread Bulat Ziganshin
Hello Andrea,

Wednesday, December 3, 2008, 5:09:21 PM, you wrote:

 How can I pass to printStuff a stdout FILE pointer?

afair, stdout syntax used to import variables. it was discussed
just a day or two ago :)


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re[2]: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Bulat Ziganshin
Hello Don,

Wednesday, December 3, 2008, 5:36:57 PM, you wrote:

 From my understanding, the gmp is GPL, GHC statically links it on windows.

 GMP is *LGPL*.

 Supporting this is trivial with a dynamically linked / DLL libgmp.

the whole problem is that it links in statically, that reduces
license to GPL


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Alex Sandro Queiroz e Silva
Hallo,

Don Stewart wrote:
 
 Supporting this is trivial with a dynamically linked / DLL libgmp. With
 a statically linked  one, it is also possible, since the API calls to
 libgmp are specified.


 Is it also possible? How?

 This shouldn't prevent commercial use -- lots of other companies have
 decided this is OK. You just need to be aware of it.
 

 They have decided this is OK as long as they can ship a shared library.

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


Re: [Haskell-cafe] handles and foreign C functions

2008-12-03 Thread Andrea Rossato
On Wed, Dec 03, 2008 at 07:08:00PM +0300, Bulat Ziganshin wrote:
 Hello Andrea,
 
 Wednesday, December 3, 2008, 5:09:21 PM, you wrote:
 
  How can I pass to printStuff a stdout FILE pointer?
 
 afair, stdout syntax used to import variables. it was discussed
 just a day or two ago :)


you mean this, I think:

foreign import ccall unsafe stdout c_stdout :: Ptr CFile

(my fault with the cutpaste of the previous message).

This is causing the segmentation fault I was talking about.

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


Re[2]: [Haskell-cafe] handles and foreign C functions

2008-12-03 Thread Bulat Ziganshin
Hello Andrea,

Wednesday, December 3, 2008, 7:23:20 PM, you wrote:

either some error in the code (i neevr used this feature) or stdout
may be defile by a macro. can you try to define function for it:

FILE *out() {return stdout;}


 On Wed, Dec 03, 2008 at 07:08:00PM +0300, Bulat Ziganshin wrote:
 Hello Andrea,
 
 Wednesday, December 3, 2008, 5:09:21 PM, you wrote:
 
  How can I pass to printStuff a stdout FILE pointer?
 
 afair, stdout syntax used to import variables. it was discussed
 just a day or two ago :)


 you mean this, I think:

 foreign import ccall unsafe stdout c_stdout :: Ptr CFile

 (my fault with the cutpaste of the previous message).

 This is causing the segmentation fault I was talking about.

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


-- 
Best regards,
 Bulatmailto:[EMAIL PROTECTED]

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


Re: [Haskell-cafe] handles and foreign C functions

2008-12-03 Thread Andrea Rossato
Hello Bulat,

On Wed, Dec 03, 2008 at 07:26:39PM +0300, Bulat Ziganshin wrote:
 either some error in the code (i neevr used this feature) or stdout
 may be defile by a macro.

the second you said:

/* C89/C99 say they're macros.  Make them happy.  */

(from stdio.h)

 can you try to define function for it:
 
 FILE *out() {return stdout;}

This does the trick.

Thank you once again.

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


Re: [Haskell-cafe] Problem building HXQ on Mac OS 10.5.5

2008-12-03 Thread Judah Jacobson
On Tue, Dec 2, 2008 at 9:49 AM, Tobias Kräntzer
[EMAIL PROTECTED] wrote:
 Hi,

 I'm new to haskell and wonted to start tinkering a bit with this language,
 specifically with HXQ. I have installed ghc with macports.

 Now while building HXQ I get the following error:

 Main.hs:20:9:
Not in scope: type constructor or class `C.SomeException'

 Unfortunately I'm also new to Mac OS X. Before I developed on Linux.
 It would be great, if someone could give me a hint.


I think you should be able to build it if you manually download the
.tar.gz file from Hackage and then type:

runghc Setup configure
runghc Setup build
runghc Setup install


The Control.Exception module was changed in ghc-6.10.1 (specifically,
in the base-4 package).  HXQ's code assumes that when compiling with
ghc-6.10 you're always using base-4; however, that compiler also comes
with base-3.0.3 which is a compatibility package providing the same
interface as previous versions of ghc.  The 'cabal install' program
tries to be helpful and selects base-3.0.3 (since HXQ does not specify
which to use), causing the above error.

I've cc'd the package author on this.  A possible fix would be to use
the extensible-exceptions package, or otherwise just copy the logic
from its .cabal file.

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


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
yes, I am talking about inserting HTML inside the wiki.Thanks, I will check
on that and report back,

hugo

On Wed, Dec 3, 2008 at 3:44 PM, John MacFarlane [EMAIL PROTECTED] wrote:

 +++ Hugo Pacheco [Dec 03 08 09:36 ]:
 Good morning,
 I wonder if it is possible to embed regular HTML code inside gitit (on
 0.3.2) pages, such as java applets like the following.
 APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100 HEIGHT
 =
 400 ALT = you should see an instance of GHood here, as an applet
 PARAM
 NAME = eventSource VALUE =factHylo.log PARAM NAME = delay
 VALUE
 =150 PARAM NAME = scale VALUE =75 /APPLET
 I am assuming that as a wiki, it is only possible to point to external
 pages.
 Thanks,
 hugo

 Of course you can put any HTML you like in the page template
 (template.html).  But I assume you are asking about HTML inside the wiki
 pages themselves. Although markdown allows embedded HTML, gitit uses
 pandoc's
 HTML sanitization feature, so things that might be dangerous (like
 applets) will be filtered out and replaced by comments.

 You could easily modify the code to remove the santitization feature.
 Just change the textToPandoc function so that stateSanitizeHtml is set to
 False.

 John




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Gluing pipes

2008-12-03 Thread Matt Hellige
From time to time, I've wanted to have a more pleasant way of writing
point-free compositions of curried functions. One might want to
transform both the first and second arguments, for instance, or only
the third argument, of a curried function. I've never known a
(non-cryptic) way to do this.

For example, given:
  f :: a - b - c
  g :: a1 - a
  h :: b2 - b
I'd like to be able to write something like:
  \ x y - f (g x) (h y)
in a way that is both point-free and applicative. In other words, I'd
like to apply a function to pipes or transformers rather than to
values.

Recent posts by Conal Elliott [1,2] got me thinking about this again,
and I've found a simple solution.

I use two of Conal's combinators:
  argument = flip (.)
  result = (.)

And now we define:
  infixr 2 ~
  f ~ g = argument f . result g

  infixl 1 $.
  ($.) = flip ($)

Which lets us write:
  -- transform both arguments
  f $. g ~ h ~ id
  -- transform just the second argument
  f $. id ~ h ~ id

The name ($.) is chosen to indicate that this is (roughly) a
composition disguised as an application. The transformer spec to the
right of ($.) looks like the type of the function to the left, and
consists of a transformer for each argument and one for the result
type. Of course, (~) is right associative, and id can match the
entire tail in bulk, so we can also write something like:
  f $. g ~ id
And of course, each transformer can be a pipeline, so assuming proper
types, we can do things like:
  f $. id ~ (length.snd.unWrap) ~ wrap

More details here:
  http://matt.immute.net/content/pointless-fun

Questions:

1. Is there already another well-known way to do this? It seems a
common enough problem...

2. Do these particular combinators already exist somewhere with other names?

3. Are there better names for these functions?

Thanks!
Matt


[1] http://conal.net/blog/posts/semantic-editor-combinators/
[2] http://conal.net/blog/posts/prettier-functions-for-wrapping-and-wrapping/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Real World Haskell, now shipping

2008-12-03 Thread Andrew Coppin

Brandon S. Allbery KF8NH wrote:

On 2008 Dec 2, at 14:44, Andrew Coppin wrote:
Regardless, it has been my general experience that almost everything 
obtained from Hackage fails miserably to compile under Windows. 
(IIRC, one package even used a Bash script as part of the build 
process!) I haven't seen similar problems on Linux. (But I don't use 
Linux very often.) About the worst problem there was Gtk2hs being 
confused about some Autoconfig stuff or something...



Many packages assume you have the msys / mingw stuff installed on 
Windows (if they work at all; those of us who don't develop on Windows 
wouldn't really know how to go about being compatible).




According to the Cabal experts, the issue is that Windows doesn't have a 
standard place for keeping header files like the various POSIX 
environments typically do. That means anything that binds an external C 
library (i.e., almost all useful Haskell packages) don't easily work on 
Windows. I'm not sure what the solution to this is...


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


Re: [Haskell-cafe] ANN: Real World Haskell, now shipping

2008-12-03 Thread Andrew Coppin

Jason Dusek wrote:

Andrew Coppin [EMAIL PROTECTED] wrote:
  

...it has been my general experience that almost everything
obtained from Hackage fails miserably to compile under
Windows. (IIRC, one package even used a Bash script as part of
the build process!) I haven't seen similar problems on Linux.
(But I don't use Linux very often.)



  I try very hard to make my programs work on Windows; and
  indeed, one of things I appreciate about Haskell is how easy
  it is to create binaries and packages that are cross platform.
  


Certainly the one or two pure Haskell packages out there (e.g., 
PureMD5) seem to build without issue. The trouble is that almost all 
useful Haskell packages are bindings to C libraries, and that varies by 
platform. :-(



  However, the only time I actually use Windows is to build and
  test my Haskell packages. Most of the people on this list --
  and I wager, most people on the mailing lists for any open
  source programming language -- are working on a NIXalike; we
  can work with bug reports, but we can't very well be the
  fabled many eyeballs on a platform we don't use. Ask not
  what your Haskell can do for you, but rather what you can do
  for your Haskell :)
  


As I say, last time I tried this, I'd just failed to build half a dozen 
other interesting packages, so by the time I'd got to trying to get 
database access working, I was frustrated to the point of giving up.


(The IRC channel is great - but only if the people you need to speak to 
happen to be there at the exact moment when you ask your question. 
Apparently I'm in a different timezone to everybody else.)



About the worst problem there was Gtk2hs being confused about
some Autoconfig stuff or something...



  Well, what else would a package built with GNU toolchain be
  confused about? Is there some miraculous language and package
  system for it where compiling libraries made with autotools is
  just a snap on Windows?
  


No no - I meant the worst problem _on Linux_ was Gtk2hs getting 
confused. (It built OK on OpenSuSE, but appears not to like Ubuntu very 
much.)


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


[Haskell-cafe] Projects that depend on the vty package?

2008-12-03 Thread Corey O'Connor
Hello,
For further development of the vty package I'm really only paying
attention to the requirements that fall out of the Yi project. Are
there any other projects that depend on the vty package?

In addition, the vty project has it's own wiki: http://trac.haskell.org/vty/
Right now there isn't much information there but it is a great place
to send bug reports or enhancement requests if you have them.

Cheers,
Corey O'Connor
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
On a different level, I was trying the wiki on my laptop, but have now
installed it in a remote server.
However, with the same configurations, I can create users but not log in, it
simply returns to the front page. It is hosted at
http://haskell.di.uminho.pt:8080

It does not seem to be a permissions problem, I gave full permissions to all
gitit files and nothing changed.
Any idea why?

Also being an headache is configuring apache reverse proxy for it:
http://haskell.di.uminho.pt/wiki/

hugo

On Wed, Dec 3, 2008 at 6:03 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 yes, I am talking about inserting HTML inside the wiki.Thanks, I will
 check on that and report back,

 hugo


 On Wed, Dec 3, 2008 at 3:44 PM, John MacFarlane [EMAIL PROTECTED] wrote:

 +++ Hugo Pacheco [Dec 03 08 09:36 ]:
 Good morning,
 I wonder if it is possible to embed regular HTML code inside gitit
 (on
 0.3.2) pages, such as java applets like the following.
 APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100
 HEIGHT =
 400 ALT = you should see an instance of GHood here, as an applet
 PARAM
 NAME = eventSource VALUE =factHylo.log PARAM NAME = delay
 VALUE
 =150 PARAM NAME = scale VALUE =75 /APPLET
 I am assuming that as a wiki, it is only possible to point to
 external
 pages.
 Thanks,
 hugo

 Of course you can put any HTML you like in the page template
 (template.html).  But I assume you are asking about HTML inside the wiki
 pages themselves. Although markdown allows embedded HTML, gitit uses
 pandoc's
 HTML sanitization feature, so things that might be dangerous (like
 applets) will be filtered out and replaced by comments.

 You could easily modify the code to remove the santitization feature.
 Just change the textToPandoc function so that stateSanitizeHtml is set to
 False.

 John




 --
 www.di.uminho.pt/~hpacheco




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
Solved, just something with my Safari cookies, sorry.

On Wed, Dec 3, 2008 at 8:40 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 On a different level, I was trying the wiki on my laptop, but have now
 installed it in a remote server.
 However, with the same configurations, I can create users but not log in,
 it simply returns to the front page. It is hosted at
 http://haskell.di.uminho.pt:8080

 It does not seem to be a permissions problem, I gave full permissions to
 all gitit files and nothing changed.
 Any idea why?

 Also being an headache is configuring apache reverse proxy for it:
 http://haskell.di.uminho.pt/wiki/

 hugo


 On Wed, Dec 3, 2008 at 6:03 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 yes, I am talking about inserting HTML inside the wiki.Thanks, I will
 check on that and report back,

 hugo


 On Wed, Dec 3, 2008 at 3:44 PM, John MacFarlane [EMAIL PROTECTED] wrote:

 +++ Hugo Pacheco [Dec 03 08 09:36 ]:
 Good morning,
 I wonder if it is possible to embed regular HTML code inside gitit
 (on
 0.3.2) pages, such as java applets like the following.
 APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100
 HEIGHT =
 400 ALT = you should see an instance of GHood here, as an applet
 PARAM
 NAME = eventSource VALUE =factHylo.log PARAM NAME = delay
 VALUE
 =150 PARAM NAME = scale VALUE =75 /APPLET
 I am assuming that as a wiki, it is only possible to point to
 external
 pages.
 Thanks,
 hugo

 Of course you can put any HTML you like in the page template
 (template.html).  But I assume you are asking about HTML inside the wiki
 pages themselves. Although markdown allows embedded HTML, gitit uses
 pandoc's
 HTML sanitization feature, so things that might be dangerous (like
 applets) will be filtered out and replaced by comments.

 You could easily modify the code to remove the santitization feature.
 Just change the textToPandoc function so that stateSanitizeHtml is set to
 False.

 John




 --
 www.di.uminho.pt/~hpacheco




 --
 www.di.uminho.pt/~hpacheco




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] library to process zip files

2008-12-03 Thread Yuriy
On Thu, Dec 04, 2008 at 11:56:10AM +1300, Yuriy wrote:
Hi,
 
Is there any haskell library to work with ZIP file format?
 
Thanks,
Yuriy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] library to process zip files

2008-12-03 Thread Jeff Heard
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zip-archive

On Wed, Dec 3, 2008 at 5:59 PM, Yuriy [EMAIL PROTECTED] wrote:
 On Thu, Dec 04, 2008 at 11:56:10AM +1300, Yuriy wrote:
 Hi,

 Is there any haskell library to work with ZIP file format?

 Thanks,
 Yuriy
 ___
 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] is there something special about the Num instance?

2008-12-03 Thread Anatoly Yakovenko
module Test where
--why does this work:
data Test = Test

class Foo t where
   foo :: Num v = t - v - IO ()

instance Foo Test where
   foo _ 1 = print $ one
   foo _ _ = print $ not one

--but this doesn't?

class Bar t where
   bar :: Foo v = t - v - IO ()

instance Bar Test where
   bar _ Test = print $ test
   bar _ _ = print $ not test
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] library to process zip files

2008-12-03 Thread Yuriy
Almost as fast as typing proper google query :)
Thanks.

On Wed, Dec 03, 2008 at 06:01:59PM -0500, Jeff Heard wrote:
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zip-archive
 
 On Wed, Dec 3, 2008 at 5:59 PM, Yuriy [EMAIL PROTECTED] wrote:
  On Thu, Dec 04, 2008 at 11:56:10AM +1300, Yuriy wrote:
  Hi,
 
  Is there any haskell library to work with ZIP file format?
 
  Thanks,
  Yuriy
  ___
  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] is there something special about the Num instance?

2008-12-03 Thread Yuriy
 Numeric literals are special. Their type is (Num t) = t, so it can
 belong to any type that is instance of Num. Whereas Test belongs to
 Test type only so you cannot call bar on any instance of Foo.

 So your pattern constrains type signature of bar more then it is
 constrained by class declaration. 
 
 On Wed, Dec 03, 2008 at 03:05:37PM -0800, Anatoly Yakovenko wrote:
  module Test where
  --why does this work:
  data Test = Test
  
  class Foo t where
 foo :: Num v = t - v - IO ()
  
  instance Foo Test where
 foo _ 1 = print $ one
 foo _ _ = print $ not one
  
  --but this doesn't?
  
  class Bar t where
 bar :: Foo v = t - v - IO ()
  
  instance Bar Test where
 bar _ Test = print $ test
 bar _ _ = print $ not test
  ___
  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] is there something special about the Num instance?

2008-12-03 Thread Daniel Fischer
Am Donnerstag, 4. Dezember 2008 00:05 schrieb Anatoly Yakovenko:
 module Test where
 --why does this work:
 data Test = Test

 class Foo t where
foo :: Num v = t - v - IO ()

 instance Foo Test where
foo _ 1 = print $ one
foo _ _ = print $ not one

 --but this doesn't?

 class Bar t where
bar :: Foo v = t - v - IO ()

 instance Bar Test where
bar _ Test = print $ test
bar _ _ = print $ not test

Because bar has to work for all types which belong to 
class Foo, but actually uses the type Test.
This is what the error message

Test.hs:18:10:
Couldn't match expected type `v' against inferred type `Test'
  `v' is a rigid type variable bound by
  the type signature for `bar' at Test.hs:15:15
In the pattern: Test
In the definition of `bar': bar _ Test = print $ test
In the definition for method `bar'

tells you. In the signature of bar, you've said that bar works for all types v 
which are members of Foo. Test is a monomorphic value of type Test, so it 
can't have type v for all v which belong to Foo.

It doesn't matter that there is so far only the one instance of Foo, there 
could be others defined in other modules.

The first works because the type of 1 in the definition of foo is defaulted to 
Integer (or whatever you specified in the default declaration).


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


Re: [Haskell-cafe] is there something special about the Num instance?

2008-12-03 Thread Ryan Ingram
Yes; I had a similar question, and it turns out Num is special, or
rather, pattern matching on integer literals is special.  See the
thread

http://www.nabble.com/Pattern-matching-on-numbers--td20571034.html

The summary is that pattern matching on a literal integer is different
than a regular pattern match; in particular:

 foo 1 = print one
 foo _ = print not one

turns into

 foo x = if x == fromInteger 1 then one else not one

whereas

 bar Test = print Test
 bar _ = print Not Test

turns into

 bar x = case x of { Test - print Test ; _ - print Not Test }

In the former case, the use of (y == fromInteger 1) means that foo
works on any argument within the class Num (which requires Eq),
whereas in the latter case, the use of the constructor Test directly
turns into a requirement for a particular type for bar.

There's no way to get special pattern matching behavior for other
types; this overloading is specific to integer literals.

  -- ryan

On Wed, Dec 3, 2008 at 3:05 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote:
 module Test where
 --why does this work:
 data Test = Test

 class Foo t where
   foo :: Num v = t - v - IO ()

 instance Foo Test where
   foo _ 1 = print $ one
   foo _ _ = print $ not one

 --but this doesn't?

 class Bar t where
   bar :: Foo v = t - v - IO ()

 instance Bar Test where
   bar _ Test = print $ test
   bar _ _ = print $ not test
 ___
 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] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
Hmm, I think I finally see the real problem.
At some point when logged in, the session expires and the wiki prompts again
for the login information. However, the cookies still assume we are logged
in and do not allow me to log in again.

The solution is to remove the cookies for the wiki server.
I think this is some kind of bug with the session state.

Regards,
hugo

On Wed, Dec 3, 2008 at 9:29 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 Solved, just something with my Safari cookies, sorry.


 On Wed, Dec 3, 2008 at 8:40 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 On a different level, I was trying the wiki on my laptop, but have now
 installed it in a remote server.
 However, with the same configurations, I can create users but not log in,
 it simply returns to the front page. It is hosted at
 http://haskell.di.uminho.pt:8080

 It does not seem to be a permissions problem, I gave full permissions to
 all gitit files and nothing changed.
 Any idea why?

 Also being an headache is configuring apache reverse proxy for it:
 http://haskell.di.uminho.pt/wiki/

 hugo


 On Wed, Dec 3, 2008 at 6:03 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 yes, I am talking about inserting HTML inside the wiki.Thanks, I will
 check on that and report back,

 hugo


 On Wed, Dec 3, 2008 at 3:44 PM, John MacFarlane [EMAIL PROTECTED]wrote:

 +++ Hugo Pacheco [Dec 03 08 09:36 ]:
 Good morning,
 I wonder if it is possible to embed regular HTML code inside gitit
 (on
 0.3.2) pages, such as java applets like the following.
 APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100
 HEIGHT =
 400 ALT = you should see an instance of GHood here, as an applet
 PARAM
 NAME = eventSource VALUE =factHylo.log PARAM NAME = delay
 VALUE
 =150 PARAM NAME = scale VALUE =75 /APPLET
 I am assuming that as a wiki, it is only possible to point to
 external
 pages.
 Thanks,
 hugo

 Of course you can put any HTML you like in the page template
 (template.html).  But I assume you are asking about HTML inside the wiki
 pages themselves. Although markdown allows embedded HTML, gitit uses
 pandoc's
 HTML sanitization feature, so things that might be dangerous (like
 applets) will be filtered out and replaced by comments.

 You could easily modify the code to remove the santitization feature.
 Just change the textToPandoc function so that stateSanitizeHtml is set
 to
 False.

 John




 --
 www.di.uminho.pt/~hpacheco




 --
 www.di.uminho.pt/~hpacheco




 --
 www.di.uminho.pt/~hpacheco




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Real World Haskell, now shipping

2008-12-03 Thread Judah Jacobson
On Wed, Dec 3, 2008 at 11:53 AM, Andrew Coppin
[EMAIL PROTECTED] wrote:
 Brandon S. Allbery KF8NH wrote:

 On 2008 Dec 2, at 14:44, Andrew Coppin wrote:

 Regardless, it has been my general experience that almost everything
 obtained from Hackage fails miserably to compile under Windows. (IIRC, one
 package even used a Bash script as part of the build process!) I haven't
 seen similar problems on Linux. (But I don't use Linux very often.) About
 the worst problem there was Gtk2hs being confused about some Autoconfig
 stuff or something...


 Many packages assume you have the msys / mingw stuff installed on Windows
 (if they work at all; those of us who don't develop on Windows wouldn't
 really know how to go about being compatible).


 According to the Cabal experts, the issue is that Windows doesn't have a
 standard place for keeping header files like the various POSIX
 environments typically do. That means anything that binds an external C
 library (i.e., almost all useful Haskell packages) don't easily work on
 Windows. I'm not sure what the solution to this is...

Have you tried passing the --extra-include-dirs and --extra-lib-dirs
arguments to 'cabal install'?  On OS X, that's how I deal with the
macports package manager which puts all library files under
/opt/local.  I've found the process pretty painless.

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


Re: [Haskell-cafe] is there something special about the Num instance?

2008-12-03 Thread Anatoly Yakovenko
Thanks for your help.

On Wed, Dec 3, 2008 at 3:47 PM, Ryan Ingram [EMAIL PROTECTED] wrote:
 Yes; I had a similar question, and it turns out Num is special, or
 rather, pattern matching on integer literals is special.  See the
 thread

 http://www.nabble.com/Pattern-matching-on-numbers--td20571034.html

 The summary is that pattern matching on a literal integer is different
 than a regular pattern match; in particular:

 foo 1 = print one
 foo _ = print not one

 turns into

 foo x = if x == fromInteger 1 then one else not one

 whereas

 bar Test = print Test
 bar _ = print Not Test

 turns into

 bar x = case x of { Test - print Test ; _ - print Not Test }

 In the former case, the use of (y == fromInteger 1) means that foo
 works on any argument within the class Num (which requires Eq),
 whereas in the latter case, the use of the constructor Test directly
 turns into a requirement for a particular type for bar.

 There's no way to get special pattern matching behavior for other
 types; this overloading is specific to integer literals.

  -- ryan

 On Wed, Dec 3, 2008 at 3:05 PM, Anatoly Yakovenko [EMAIL PROTECTED] wrote:
 module Test where
 --why does this work:
 data Test = Test

 class Foo t where
   foo :: Num v = t - v - IO ()

 instance Foo Test where
   foo _ 1 = print $ one
   foo _ _ = print $ not one

 --but this doesn't?

 class Bar t where
   bar :: Foo v = t - v - IO ()

 instance Bar Test where
   bar _ Test = print $ test
   bar _ _ = print $ not test
 ___
 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: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Anatoly Yakovenko
This is pretty cool.  I was wondering how much work would it be for
gitit to be able to use markdown from the comment sections in source
files?  It would be a really good way to manage documentation.

Basically I would like to be able to point gitit at an existing git
repo, and have it provide a wiki interface to all the documentation so
developers can view and modify it.

Thanks,
Anatoly

2008/12/3 Hugo Pacheco [EMAIL PROTECTED]:
 Hmm, I think I finally see the real problem.
 At some point when logged in, the session expires and the wiki prompts again
 for the login information. However, the cookies still assume we are logged
 in and do not allow me to log in again.
 The solution is to remove the cookies for the wiki server.
 I think this is some kind of bug with the session state.
 Regards,
 hugo
 On Wed, Dec 3, 2008 at 9:29 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 Solved, just something with my Safari cookies, sorry.

 On Wed, Dec 3, 2008 at 8:40 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 On a different level, I was trying the wiki on my laptop, but have now
 installed it in a remote server.
 However, with the same configurations, I can create users but not log in,
 it simply returns to the front page. It is hosted
 at http://haskell.di.uminho.pt:8080
 It does not seem to be a permissions problem, I gave full permissions to
 all gitit files and nothing changed.
 Any idea why?
 Also being an headache is configuring apache reverse proxy for
 it: http://haskell.di.uminho.pt/wiki/
 hugo

 On Wed, Dec 3, 2008 at 6:03 PM, Hugo Pacheco [EMAIL PROTECTED] wrote:

 yes, I am talking about inserting HTML inside the wiki.
 Thanks, I will check on that and report back,
 hugo

 On Wed, Dec 3, 2008 at 3:44 PM, John MacFarlane [EMAIL PROTECTED]
 wrote:

 +++ Hugo Pacheco [Dec 03 08 09:36 ]:
 Good morning,
 I wonder if it is possible to embed regular HTML code inside gitit
  (on
 0.3.2) pages, such as java applets like the following.
 APPLET CODE = GHood.class ARCHIVE = GHood.jar WIDTH = 1100
  HEIGHT =
 400 ALT = you should see an instance of GHood here, as an
  applet PARAM
 NAME = eventSource VALUE =factHylo.log PARAM NAME = delay
  VALUE
 =150 PARAM NAME = scale VALUE =75 /APPLET
 I am assuming that as a wiki, it is only possible to point to
  external
 pages.
 Thanks,
 hugo

 Of course you can put any HTML you like in the page template
 (template.html).  But I assume you are asking about HTML inside the
 wiki
 pages themselves. Although markdown allows embedded HTML, gitit uses
 pandoc's
 HTML sanitization feature, so things that might be dangerous (like
 applets) will be filtered out and replaced by comments.

 You could easily modify the code to remove the santitization feature.
 Just change the textToPandoc function so that stateSanitizeHtml is set
 to
 False.

 John




 --
 www.di.uminho.pt/~hpacheco



 --
 www.di.uminho.pt/~hpacheco



 --
 www.di.uminho.pt/~hpacheco



 --
 www.di.uminho.pt/~hpacheco

 ___
 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] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread John MacFarlane
+++ Anatoly Yakovenko [Dec 03 08 17:03 ]:
 This is pretty cool.  I was wondering how much work would it be for
 gitit to be able to use markdown from the comment sections in source
 files?  It would be a really good way to manage documentation.
 
 Basically I would like to be able to point gitit at an existing git
 repo, and have it provide a wiki interface to all the documentation so
 developers can view and modify it.

You can do something like that now. You can specify the repository
directory in a configuration file. Anything in the repository (even
in subdirectories) with a .page extension will be served up as a
wiki page. So you'd have to use a .page extension for your markdown
documentation. Everything else in the repository will appear in the
index. Source code files will be automatically syntax-highlighted, and
you can even view history and diffs through the wiki interface.

But I guess what you want is for the documentation to be in comments
in the source files themselves, not in separate files.  I'm not sure
how to do that -- would the idea be to show just the documentation,
perhaps marked off with some special notation, and not the source?
But then we lose a nice feature, the ability to view source files.
I'm open to ideas.

Soon, gitit will contain support for pages in markdownish literate
Haskell, which might be the best of both worlds for Haskell projects.
(They'd still need the .page extension, since some .lhs files are
LaTeX lhs, but one could use hard links, or there could be a
configuration option to treat .lhs files as wiki pages.)

John

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


[Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Anatoly Yakovenko
On Wed, Dec 3, 2008 at 5:54 PM, John MacFarlane [EMAIL PROTECTED] wrote:
 +++ Anatoly Yakovenko [Dec 03 08 17:03 ]:
 This is pretty cool.  I was wondering how much work would it be for
 gitit to be able to use markdown from the comment sections in source
 files?  It would be a really good way to manage documentation.

 Basically I would like to be able to point gitit at an existing git
 repo, and have it provide a wiki interface to all the documentation so
 developers can view and modify it.

 You can do something like that now. You can specify the repository
 directory in a configuration file. Anything in the repository (even
 in subdirectories) with a .page extension will be served up as a
 wiki page. So you'd have to use a .page extension for your markdown
 documentation. Everything else in the repository will appear in the
 index. Source code files will be automatically syntax-highlighted, and
 you can even view history and diffs through the wiki interface.

cool.  Does it add any other files to the reposoitory?  Could you use
it over a read only one?

 But I guess what you want is for the documentation to be in comments
 in the source files themselves, not in separate files.  I'm not sure
 how to do that -- would the idea be to show just the documentation,
 perhaps marked off with some special notation, and not the source?
 But then we lose a nice feature, the ability to view source files.
 I'm open to ideas.

I was thinking it would show both the documentation and the source,
but have the documentation as the editable part of the page.  Do you
think that's possible?

Or it could parse out the documentation and show 2 dynamically
generated pages, one for just the docs and one for the source.  But i
think it would be useful to be able to see the documentation in the
context of the source that its referring to.

Unfortunately I am not a web guy, so i have no idea how hard any of
this would be :).
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Re[2]: [Haskell-cafe] GHC on Fedora 10 - getMBlock: mmap: Permission denied

2008-12-03 Thread John D. Ramsdell
I had fun with SELinux when using Haskell for CGI programs.  The
default SELinux policy forbids CGI programs that execute code in their
data segment. I had to write a policy module that allowed
httpd_sys_script_t self:process execmem.  Oh joy.

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


Re: [Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Hugo Pacheco
I think that Anatoly was suggestion a bridge between markdown and haddock
syntax.
Of course gitit would read haddock-documented sources and generate different
results than haddock itself (showing highlighted source code is the most
significant).

Being practical, this is very close to the markdownish literate haskell you
are suggesting.

hugo

On Thu, Dec 4, 2008 at 1:54 AM, John MacFarlane [EMAIL PROTECTED] wrote:

 +++ Anatoly Yakovenko [Dec 03 08 17:03 ]:
  This is pretty cool.  I was wondering how much work would it be for
  gitit to be able to use markdown from the comment sections in source
  files?  It would be a really good way to manage documentation.
 
  Basically I would like to be able to point gitit at an existing git
  repo, and have it provide a wiki interface to all the documentation so
  developers can view and modify it.

 You can do something like that now. You can specify the repository
 directory in a configuration file. Anything in the repository (even
 in subdirectories) with a .page extension will be served up as a
 wiki page. So you'd have to use a .page extension for your markdown
 documentation. Everything else in the repository will appear in the
 index. Source code files will be automatically syntax-highlighted, and
 you can even view history and diffs through the wiki interface.

 But I guess what you want is for the documentation to be in comments
 in the source files themselves, not in separate files.  I'm not sure
 how to do that -- would the idea be to show just the documentation,
 perhaps marked off with some special notation, and not the source?
 But then we lose a nice feature, the ability to view source files.
 I'm open to ideas.

 Soon, gitit will contain support for pages in markdownish literate
 Haskell, which might be the best of both worlds for Haskell projects.
 (They'd still need the .page extension, since some .lhs files are
 LaTeX lhs, but one could use hard links, or there could be a
 configuration option to treat .lhs files as wiki pages.)

 John

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




-- 
www.di.uminho.pt/~hpacheco
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc

2008-12-03 Thread Anatoly Yakovenko
 Being practical, this is very close to the markdownish literate haskell you
 are suggesting.
 hugo

yea, i agree.  But is there any way to generalize this to non haskell projects?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Real World Haskell, now shipping

2008-12-03 Thread Don Stewart
andrewcoppin:
 Jason Dusek wrote:
 Andrew Coppin [EMAIL PROTECTED] wrote:
   
 ...it has been my general experience that almost everything
 obtained from Hackage fails miserably to compile under
 Windows. (IIRC, one package even used a Bash script as part of
 the build process!) I haven't seen similar problems on Linux.
 (But I don't use Linux very often.)
 
 
   I try very hard to make my programs work on Windows; and
   indeed, one of things I appreciate about Haskell is how easy
   it is to create binaries and packages that are cross platform.
   
 
 Certainly the one or two pure Haskell packages out there (e.g., 
 PureMD5) seem to build without issue. The trouble is that almost all 
 useful Haskell packages are bindings to C libraries, and that varies by 
 platform. :-(
 
   However, the only time I actually use Windows is to build and
   test my Haskell packages. Most of the people on this list --
   and I wager, most people on the mailing lists for any open
   source programming language -- are working on a NIXalike; we
   can work with bug reports, but we can't very well be the
   fabled many eyeballs on a platform we don't use. Ask not
   what your Haskell can do for you, but rather what you can do
   for your Haskell :)
   
 
 As I say, last time I tried this, I'd just failed to build half a dozen 
 other interesting packages, so by the time I'd got to trying to get 
 database access working, I was frustrated to the point of giving up.
 

Do you mail the maintainers when there's a bulid failure?
There's around 1000 packages on hackage now, and we don't have a build
farm, so you can make a real difference by mailing authors when their
package fails on windows.

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


Re: Re[2]: [Haskell-cafe] gmp license == no commercial/closed source haskell software ??

2008-12-03 Thread Jason Dusek
Bulat Ziganshin [EMAIL PROTECTED] wrote:
 Don wrote:
  Lionel wrote:
   From my understanding, the gmp is GPL, GHC statically
   links it on windows.
 
  GMP is *LGPL*.
 
  Supporting this is trivial with a dynamically linked / DLL
  libgmp.

 the whole problem is that it links in statically, that reduces
 license to GPL

  Jonathan Cast suggests earlier that there is some wiggle room
  allowed in 4/(d), even for statically linked programs:

 d) Do one of the following:

   0) Convey the Minimal Corresponding Source under the terms of
  this License, and the Corresponding Application Code in a
  form suitable for, and under terms that permit, the user
  to recombine or relink the Application with a modified
  version of the Linked Version to produce a modified
  Combined Work, in the manner specified by section 6 of the
  GNU GPL for conveying Corresponding Source.

   1) Use a suitable shared library mechanism for linking with
  the Library. A suitable mechanism is one that (a) uses at
  run time a copy of the Library already present on the
  user's computer system, and (b) will operate properly with
  a modified version of the Library that is
  interface-compatible with the Linked Version.

  At first glance, (0) would seem to apply to a statically
  linked application; and it appears damning. However:

The Minimal Corresponding Source for a Combined Work means
the Corresponding Source for the Combined Work, excluding
any source code for portions of the Combined Work that,
considered in isolation, are based on the Application, and
not on the Linked Version.

The Corresponding Application Code for a Combined Work
means the object code and/or source code for the
Application, including any data and utility programs needed
for reproducing the Combined Work from the Application, but
excluding the System Libraries of the Combined Work.

  The latter definition admits object code and this seems to be
  in line with what Cast is saying. The former definition is for
  the actual source code that must be included -- it is somewhat
  vague. If an application relies heavily on multi-precision
  arithmetic, even through adapter classes, is everything in it
  based on the Linked Version?

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