Re: [Haskell-cafe] Re: HFuse: ls fails in HelloFS

2008-03-19 Thread Brandon S. Allbery KF8NH


On Mar 19, 2008, at 2:12 , Austin Seipp wrote:

Excerpts from Will Thompson's message of Sun Mar 16 08:37:00 -0500  
2008:

Currently the module's name is HFuse.  Presumably it really belongs
under System somewhere; System.Posix.Fuse maybe?  What do folks  
think?

Are there any guidelines for picking a namespace?


I don't think there's any sort of doc on picking a namespace or how to
logically name your package modules (would likely be worth writing);
for something like this, I would say something under System.Posix.*
would be the most appropriate.


Erm, POSIX does not mean Linux and sufficiently similar systems.   
FUSE is supported by open source Unixlikes, not by POSIX compliant  
systems in general.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon universityKF8NH


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


Re: [Haskell-cafe] Re: HFuse: ls fails in HelloFS

2008-03-19 Thread Don Stewart
mad.one:
 Excerpts from Will Thompson's message of Sun Mar 16 08:37:00 -0500 2008:
  Currently the module's name is HFuse.  Presumably it really belongs
  under System somewhere; System.Posix.Fuse maybe?  What do folks think?
  Are there any guidelines for picking a namespace?
 
 I don't think there's any sort of doc on picking a namespace or how to
 logically name your package modules (would likely be worth writing); 
 for something like this, I would say something under System.Posix.*
 would be the most appropriate.

Ah, but there is!

http://haskell.org/haskellwiki/Hierarchical_module_names

Enjoy!

-- Don (grumbler of packages that use uncommon top level names)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Any ideas for - (function type) in a simply-typed lambda calculus version of Brett Victor's Alligator Eggs game?

2008-03-19 Thread Benjamin L. Russell
Brett Victor has invented an Alligator Eggs game (very
loosely resembling Conway's Game of Life), using
formal rules to determine feeding and breeding
patterns for alligators and their eggs, but the game
represents the *untyped* lambda calculus:

Alligator Eggs!
http://worrydream.com/AlligatorEggs/

I am interested in adapting this to the *simply typed*
lambda calculus with Curry-style typing, to aid
students of Haskell.  Brett Victor's game currently
aids students of LISP, and I think that it would be
helpful to have a Haskell counterpart (see
http://wadler.blogspot.com/2007/05/oh-no-alligators.html
for a comment on how the Alligator Eggs game has been
used by EE students at Caltech in learning LISP):

Simply typed lambda calculus - Wikipedia, the free
encyclopedia
http://en.wikipedia.org/wiki/Simply_typed_lambda_calculus

Thereafter, I would like to create a new entry for
this Haskell version of Alligator Eggs on HaskellWiki,
and create a link to it under a new subsection, Board
Games, under the current Learning Haskell category:

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

In Brett Victor's version, the following
representations hold:

* a hungry alligator:  lambda abstraction
* an old alligator:  a pair of parentheses
* an egg:  a variable
* the Eating Rule:  beta-reduction
* the Color Rule:  (over-cautious) alpha-conversion
* the Old Age Rule:  the rule that a pair of
parentheses containing a single term may be removed

However, in thinking about how to adapt the game, I am
not quite sure how to incorporate the representation
of - (function type):

* ???:  - (function type)

What ideas, if any, would anybody have on how -
(function type) could be represented in a simply-typed
lambda calculus version of Brett Victor's Alligator
Eggs?

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


[Haskell-cafe] Re: GADT rhymes with cat

2008-03-19 Thread Chung-chieh Shan
[EMAIL PROTECTED] wrote in article [EMAIL PROTECTED] in 
gmane.comp.lang.haskell.cafe:
 Quoting Jeremy Apthorp [EMAIL PROTECTED]:
  Clearly, this pronounciation is gay dee tea. I always new those
  types were a bit queer.
 Not that there's anything wrong with that.

... If it type-checks, it must be correct!

I thought the t was silent as well, an unaspirated stop?  Egad!

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
Is mathematics a syntax of language?

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


[Haskell-cafe] Scoping in template haskell

2008-03-19 Thread Lars Oppermann
Hi all,

I am trying to get familiar with template haskell and I'm wondering
whether the following is possible and if so, how it would be done
properly...

 I have two templates, and I'd like to use one from the other. For
instance the first one might be

gen1 :: Int - ExpQ
gen1 i = [|  ++ (show i) ++  |]

Thus, I gould do

 $(gen1 42)

and I'd get 42

now I'd like to use gen2 in another generated expression so that I could so

 $(gen2 [42, 66])

and get 4266

My naive intention was to write

gen2 :: [Int] - ExpQ
gen2 is = [| map (\x - $(gen1 x)) is |]

which gives me Stage error: `x' is bound at stage 2 but used at stage 1

So I guess my actual question would be: how do I pass a variable bound
outside  a quotation into another splice used in that quotation?

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


Re: [Haskell-cafe] Dynamic typing makes you more productive?

2008-03-19 Thread Philip Armstrong

On Tue, Mar 18, 2008 at 09:41:15AM -0700, Justin Bailey wrote:

Two years ago I would have agreed with that statement. Now - no way.
Make the compiler work for you. I've done a lot of Ruby development
and I would never use it for a project of more than 3 or 4 people.
It's an awesome language but I don't think it would scale to
programming in the large. Any object can be modified at any time.
Determining where a particular method comes from can be an exercise in
Sherlockian deduction. Give an organization of 100 developers that
much freedom and I can only imagine chaos would result.


It looks from the outside like Ruby is going through some growing
pains as a result of the excerise of too much freedom at the
moment. But I wouldn't write Ruby off on account of that: an
interesting article I read recently made the comparision with Emacs
lisp which offers a similar level of power to the programmer, in that
pretty much any function can be redefined at any point, and yet it has
a thriving culture of Emacs extensions, all written by disparate
people who manage not to step on each other's toes.

IOW, it's a cultural issue as well as a language issue. Ruby
programmers will no doubt develop their own culture of what is and
isn't allowed in publically available extensions just as Emacs lisp
programmers have.

Phil

--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Satnam Singh of Microsoft Research

2008-03-19 Thread Donnie Jones
Hello,

I contacted Satnam Singh about this talk and we tried to arrange with
Stanford to video record the presentation, but it was not possible on the
short notice...
__
Donnie

On 3/18/08, Galchin Vasili [EMAIL PROTECTED] wrote:

 oops ... my bad ... it was at Standford's CS dept on Feb 29 at 1:30:


 This presentation describes a variety of ways to write parallel and
 concurrent programs in the lazy functional language Haskell. We start off by
 introducing par/pseq annotations which provide guidance to the run-time
 about how work can be performed speculatively which provides a basic
 mechanism for writing implicitly parallel programs. We then describe how a
 library of strategies can be used to force specific evaluation orders which
 are necessary to exploit parallelism. We then go on to describe the basic
 mechanism for writing explicitly parallel programs using Haskell's
 lightweight threads and then we describe how Haskell's STM implementation
 can help to write programs that share state between threads through the use
 of a special monads and as an example we describe the implementation of a
 multi-way rendezvous library. We then describe some work with Tim Harris on
 feedback directed implicit parallelism which provides yet another way to
 write implicitly parallel programs with out resorting to par/pseq
 annotations. Finally, we report on the progress of a nested data parallel
 library for Haskell inspired by the NESL language. Throughout the talk we
 shall emphasizes how Haskell's pure nature (with side
 effecting operations clearly indicated by the type system) facilitates the
 exploitation of parallelism.

 It would be great to get more than the above!

 Regards.

 Vasili






 On 3/18/08, Adam Langley [EMAIL PROTECTED] wrote:
 
  2008/3/18 Galchin Vasili [EMAIL PROTECTED]:
   Recently Satnam Singh of Microsoft Research gave a talk at Google
  about
   concurrency, Haskell STM, etc. Was there a transcript of this talk?
 
  Do you have the exact date of this talk? I can't see that anyone
  called Satnam has given a talk at Google.
 
  (It might have been very informal, in which case there wouldn't be a
  record of it, and nor would there be a video)
 
 
  Cheers,
 
  AGL
 
  --
  Adam Langley [EMAIL PROTECTED] http://www.imperialviolet.org
 


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


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


Re: [Haskell-cafe] Satnam Singh of Microsoft Research

2008-03-19 Thread Steve Lihn
Related news --

Intel, Microsoft choose UC-Berkeley to host $10M parallel computing center

March 19, 2008 8:36 AM ET

http://news.moneycentral.msn.com/provider/providerarticle.aspx?feed=ACBJdate=20080319id=8361298
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equality constraints in type families

2008-03-19 Thread Claus Reinke

type family F a :: * - *

..
We made the design 
choice that type functions with a higher-kinded result type must be 
injective with respect to the additional paramters. I.e. in your case:


 F x y ~ F u v = F x ~ F u /\ y ~ v


i'm still trying to understand this remark:

- if we are talking about type functions, i should be allowed
   to replace a function application with its result, and if that
   result doesn't mention some parameters, they shouldn't
   play a role at any stage, right?

- if anything other than the function result matters, isn't it
   somewhat misleading to speak of type functions?

- if the parameters have to match irrespective of whether
   they appear in the result, that sounds like phantom types.

   ok, but we're talking about a system that mixes unification
   with rewriting, so shouldn't the phantom parameters be
   represented in all rewrite results, just to make sure they
   cannot be ignored in any contexts?

   ie, with

   type instance F a = rhs

   F a x should rewrite not to rhs, but to rhs_x,
   which would take care of the injectivity you want in the
   ~-case, but would also preserve the distinction if 
   rewriting should come before ~, even if rhs managed
   to consume x, by being a constant function on types. 


- things seem to be going wrong in the current implementation.
   consider this code, accepted by GHCi, version 6.9.20080317:
--
{-# LANGUAGE TypeFamilies #-}

type family Const a :: * - *
type instance Const a = C a
type C a t = a

f :: Const Bool Int - Const Bool Char - Const Bool Bool
f i c = False
-- f i c = i
f i c = i  True
f i c = (i || c) 
--


   (note the partially applied type synonym in the type instance,
   which is a constant function on types). it looks as if:

   - False::Bool is accepted as Const Bool Bool
   - i::Const Bool Int is accepted as Bool
   - c::Const Bool Char is accepted as Bool
   - both i and c are accepted as Bool, so seem to be of
   an equivalent type, but aren't really..
   - i::Const Bool Int is not accepted as Const Bool Char
   directly, but is accepted via one of the eta expansions 
   for Bool, namely (True)


my current guess is that the implementation is incomplete,
but that the idea of type functions also needs to be adjusted
to take your design decision into account, with phantom types
and type parameter annotations for type function results 
suggesting themselves as potentially helpful concepts?


or, perhaps, the implication isn't quite correct, and 
type parameters shouldn't be unified unless they appear

in the result of applying the type function? the implementation
would still be incomplete, but instead of rejecting more of the
code, it should allow the commented-out case as well?

could you please help me to clear up this confusion?-)

thanks,
claus



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


Re: [Haskell-cafe] Equality constraints in type families

2008-03-19 Thread Tom Schrijvers

could you please help me to clear up this confusion?-)


Let me summarize :-)

The current design for type functions with result kinds other than *
(e.g. * - *) has not gotten very far yet. We are currently stabilizing 
the ordinary * type functions, and writing the story up. When that's done 
we can properly focus on this issue and consider different design choices.


Cheers,

Tom

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: [EMAIL PROTECTED]
url: http://www.cs.kuleuven.be/~toms/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Equality constraints in type families

2008-03-19 Thread Claus Reinke

type family F a :: * - *

..
We made the design 
choice that type functions with a higher-kinded result type must be 
injective with respect to the additional paramters. I.e. in your case:


 F x y ~ F u v = F x ~ F u /\ y ~ v


actually, i don't even understand the first part of that:-(

why would F x and F u have to be the same functions?
shouldn't it be sufficient for them to have the same result,
when applied to y and v, respectively?

consider:
   --
   type family G1 a :: * - *
   type instance G1 a = G3

   type family G2 a :: * - *
   type instance G2 a = G4

   type family G3 a :: *
   type instance G3 Bool = Bool
   type instance G3 Char = Bool

   type family G4 a :: *
   type instance G4 Bool = Char
   type instance G4 Char = Bool

   h :: G1 a Bool ~ G2 a Char = G1 a Bool
   h = True
   --
for which GHCi, version 6.9.20080317 happily infers

   *Main :t h
   h :: G1 a Bool
   *Main h
   True

even though G1 a ~ G3 ~/~ G4 ~ G2 a ?

claus


i'm still trying to understand this remark:

- if we are talking about type functions, i should be allowed
   to replace a function application with its result, and if that
   result doesn't mention some parameters, they shouldn't
   play a role at any stage, right?

- if anything other than the function result matters, isn't it
   somewhat misleading to speak of type functions?

- if the parameters have to match irrespective of whether
   they appear in the result, that sounds like phantom types.

   ok, but we're talking about a system that mixes unification
   with rewriting, so shouldn't the phantom parameters be
   represented in all rewrite results, just to make sure they
   cannot be ignored in any contexts?

   ie, with

   type instance F a = rhs

   F a x should rewrite not to rhs, but to rhs_x,
   which would take care of the injectivity you want in the
   ~-case, but would also preserve the distinction if 
   rewriting should come before ~, even if rhs managed
   to consume x, by being a constant function on types. 


- things seem to be going wrong in the current implementation.
   consider this code, accepted by GHCi, version 6.9.20080317:
--
{-# LANGUAGE TypeFamilies #-}

type family Const a :: * - *
type instance Const a = C a
type C a t = a

f :: Const Bool Int - Const Bool Char - Const Bool Bool
f i c = False
-- f i c = i
f i c = i  True
f i c = (i || c) 
--


   (note the partially applied type synonym in the type instance,
   which is a constant function on types). it looks as if:

   - False::Bool is accepted as Const Bool Bool
   - i::Const Bool Int is accepted as Bool
   - c::Const Bool Char is accepted as Bool
   - both i and c are accepted as Bool, so seem to be of
   an equivalent type, but aren't really..
   - i::Const Bool Int is not accepted as Const Bool Char
   directly, but is accepted via one of the eta expansions 
   for Bool, namely (True)


my current guess is that the implementation is incomplete,
but that the idea of type functions also needs to be adjusted
to take your design decision into account, with phantom types
and type parameter annotations for type function results 
suggesting themselves as potentially helpful concepts?


or, perhaps, the implication isn't quite correct, and 
type parameters shouldn't be unified unless they appear

in the result of applying the type function? the implementation
would still be incomplete, but instead of rejecting more of the
code, it should allow the commented-out case as well?

could you please help me to clear up this confusion?-)

thanks,
claus



___
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] ghc 6.8.2 and timer_create error

2008-03-19 Thread Anatoly Yakovenko
I have a gentoo box with ghc 6.8.2, and the binaries that ghc builds
on that box do not work on redhat EL 4 or ubuntu 7.10.  When I try to
run the binary, i get an error:

Main: timer_create: Invalid argument

so is there any way to get ghc to build a binary that doesn't use
timer_create?  or is that something that is configured when ghc itself
is built, if so, how do I turn that feature off?

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


Re: [Haskell-cafe] Scoping in template haskell

2008-03-19 Thread Ryan Ingram
First off, the first code isn't doing exactly what you think; gen1 3,
for example, generates the parse tree:
++ show 3 ++ 
You can improve this in the following way:
  gen1 i = let x =  ++ show i ++  in [| x |]
which generates (for gen1 3, again)
   ['', '', '3', '', '']

Alternatively, you can generate the expression directly:
  gen1 i = LitE $ StringE $  ++ show i ++ 
which gives you exactly the parse tree
  3.

Now, the compiler will definitely treat the last two the same, but I'm
not sure it will constant-fold show 3 into 3 in your case.

The runQ trick is really useful; in ghci; just use runQ with the
code that you want to generate:

 :set -fth
 :m +Language.Haskell.TH
 runQ [| 4266 |]
LitE (StringL 4266)

You then just need to figure out how to make that object from the
inputs you have.

Also, here's something simple to try:

appendStrQ :: [ExpQ] - ExpQ
appendStrQ = foldr (\x rest - [| $(x) ++ $(rest) |]) [|  |]

gen2 = appendStrQ . map gen1

  -- ryan

On Wed, Mar 19, 2008 at 5:17 AM, Lars Oppermann [EMAIL PROTECTED] wrote:
 Hi all,

  I am trying to get familiar with template haskell and I'm wondering
  whether the following is possible and if so, how it would be done
  properly...

   I have two templates, and I'd like to use one from the other. For
  instance the first one might be

  gen1 :: Int - ExpQ
  gen1 i = [|  ++ (show i) ++  |]

  Thus, I gould do

   $(gen1 42)

  and I'd get 42

  now I'd like to use gen2 in another generated expression so that I could so

   $(gen2 [42, 66])

  and get 4266

  My naive intention was to write

  gen2 :: [Int] - ExpQ
  gen2 is = [| map (\x - $(gen1 x)) is |]

  which gives me Stage error: `x' is bound at stage 2 but used at stage 1

  So I guess my actual question would be: how do I pass a variable bound
  outside  a quotation into another splice used in that quotation?

  Bests,
  Lars
  ___
  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] Scoping in template haskell

2008-03-19 Thread Ryan Ingram
On Wed, Mar 19, 2008 at 10:46 AM, Ryan Ingram [EMAIL PROTECTED] wrote:
   gen1 i = LitE $ StringE $  ++ show i ++ 

Oops, two mistakes here:
1) StringE should be StringL
2) splices need to be in the Q monad.

To fix (2), you can either add a return here, or, there are
conveniently lowercase constructors for much of TH that return results
in the Q monad:
 gen1 i = return $ LitE $ StringL $  ++ show i ++ 
or
 gen1 i = litE $ StringL $  ++ show i ++ 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: ghc 6.8.2 and timer_create error

2008-03-19 Thread Christian Maeder
This was discussed in
http://www.haskell.org/pipermail/glasgow-haskell-users/2008-March/014498.html

Your final guess is correct. #undef HAVE_TIMER_CREATE and/or
USE_TIMER_CREATE in mk/config.h

HTH Christian

Anatoly Yakovenko wrote:
 I have a gentoo box with ghc 6.8.2, and the binaries that ghc builds
 on that box do not work on redhat EL 4 or ubuntu 7.10.  When I try to
 run the binary, i get an error:
 
 Main: timer_create: Invalid argument
 
 so is there any way to get ghc to build a binary that doesn't use
 timer_create?  or is that something that is configured when ghc itself
 is built, if so, how do I turn that feature off?
 
 Thanks
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Using HaskellDb to connect to PostgresSql

2008-03-19 Thread Marc Mertens
Hello,

 I'm trying to learn to use HaskellDb. I have managed to finally compile and
install it on my linux box (I have ghc 6.8.2). But when I try to create a
database description (as described in
http://haskelldb.sourceforge.net/getting-started.html) (using DBDirect-dynamic
instead of DBDirect) I'm stuck. I have tried different names for the driver but
I always get the message 'DBDirect-dynamic: user error (Missing field driver)'.
Has someone get this working for PostgresSQL and if so, can he/she help me out
with some instructions. Also if someone has some pointers to more recent
documentation of HaskellDB, I would really be pleased if I could get these.


Marc Mertens

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


[Haskell-cafe] libmad and os/x coreaudio wrappers

2008-03-19 Thread Chris Waterson

Hi there!  I've taken my first stab at writing some (admittedly
minimal) libraries for Haskell, and would love to get feedback on
them:

  * hmad: a wrapper for the libmad MP3 decoder.
  http://maubi.net/~waterson/REPO/hmad

  * CoreAudio: a wrapper for OS/X CoreAudio.
  http://maubi.net/~waterson/REPO/CoreAudio

(You should be able to darcs get the above links, if you want.)

I wrote the libmad wrapper to generate a stream (i.e., a lazy list)
of audio samples.  CoreAudio allows the input stream to be lazy, as
well.  So, here's a simple MP3 player:

 module Main where

 import Sound.CoreAudio
 import Codec.Audio.MP3.Mad
 import qualified Data.ByteString.Lazy as B
 import System
 import System.IO

 main :: IO ()
 main = do files - getArgs
   mapM_ playFile files

 playFile :: String - IO ()
 playFile file =
 withBinaryFile file ReadMode $ \ inHandle -
do xs  - B.hGetContents inHandle
   samples - decode xs
   play samples

I do have a couple questions...

  * The CoreAudio library requires its users to be compiled with
-threaded.  Is there a way to specify that in the Cabal file?

  * I wanted to be able to generate a variety of streams from libmad.
Besides stereo linear PCM data, it also seemed like it might be
worth-while to produce a stream of MP3 frame headers, the
unsynthesized frequency domain data, and so on.  I tried to
accomplish this with a the DecoderSink class, but I'm not sure I
succeeded.  Any thoughts here would be appreciated!

I hope someone else finds these useful.  The FFI was a joy to use once
I figured it out... :)

chris


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


Re: [Haskell-cafe] Equality constraints in type families

2008-03-19 Thread Claus Reinke

Let me summarize :-)

The current design for type functions with result kinds other than *
(e.g. * - *) has not gotten very far yet. We are currently stabilizing 
the ordinary * type functions, and writing the story up. When that's done 
we can properly focus on this issue and consider different design choices.


thanks, seems i was too optimistic, then!-)

btw, i noticed that the user guide points to the haskell wiki only,
while the latest info seems to be on the ghc wiki. given the number
of variations and the scope of development, it would also be 
helpful if the user guide had at least a one-paragraph executive

summary of the state of play, dated to clarify how up-to-date
that summary is.

that would avoid discussions of not yet stabilized features
(should ghc issue a warning when such are used?).

claus


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


Re: [Haskell-cafe] Using HaskellDb to connect to PostgresSql

2008-03-19 Thread Justin Bailey
On Wed, Mar 19, 2008 at 10:55 AM, Marc Mertens [EMAIL PROTECTED] wrote:
 Hello,

  I'm trying to learn to use HaskellDb. I have managed to finally compile 
 and
  install it on my linux box (I have ghc 6.8.2). But when I try to create a
  database description (as described in
  http://haskelldb.sourceforge.net/getting-started.html) (using 
 DBDirect-dynamic
  instead of DBDirect) I'm stuck. I have tried different names for the driver 
 but


I don't have much information about using DBDynamic, but I am able to
connect to PostgreSQL easily. I have done it on Windows using GHC
6.8.2. I am using hdbc-postgresql, since hsql would not compile on
Windows for me. Here are the import statements and the login function
I have for a simple program that connects to postgresql and writes out
table info:

import Database.HaskellDB.DBSpec.DatabaseToDBSpec
import Database.HaskellDB.DBSpec.DBSpecToDBDirect
import Database.HaskellDB.Database
import Database.HaskellDB.HDBC.PostgreSQL
import Database.HaskellDB.PrimQuery
import Database.HaskellDB.FieldType
import Database.HaskellDB.DBSpec

login :: MonadIO m = String - Int - String - String - String -
(Database - m a) - m a
login server port user password dbname = postgresqlConnect [(host, server),
  (port, show port),
  (user, user),
  (password, password),
  (dbname, dbname)]

The versions of all packages I'm using are:

  HDBC-1.1.4
  HDBC-postgresql-1.1.4.0
  haskelldb-hdbc-0.10
  haskelldb-hdbc-postgresql-0.10

Note you might have to modify the haskelldb cabal files to get them to
use later versions of HDBC.

As for recent documentation, unfortunately the darcs repository and
the code is the best place to go. The haddock documentation doesn't
have everything.

Finally, I'd suggest joining the haskell-db users mailing list for
specific questions. You can find info about that and the darcs
repository on the homepage at http://haskelldb.sourceforge.net.

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


Re: [Haskell-cafe] libmad and os/x coreaudio wrappers

2008-03-19 Thread gwern0
On 2008.03.19 11:09:00 -0700, Chris Waterson [EMAIL PROTECTED] scribbled 1.7K 
characters:
 Hi there!  I've taken my first stab at writing some (admittedly
 minimal) libraries for Haskell, and would love to get feedback on
 them:

   * hmad: a wrapper for the libmad MP3 decoder.
   http://maubi.net/~waterson/REPO/hmad

   * CoreAudio: a wrapper for OS/X CoreAudio.
   http://maubi.net/~waterson/REPO/CoreAudio

 (You should be able to darcs get the above links, if you want.)

 I wrote the libmad wrapper to generate a stream (i.e., a lazy list)
 of audio samples.  CoreAudio allows the input stream to be lazy, as
 well.  So, here's a simple MP3 player:

  module Main where
 
  import Sound.CoreAudio
  import Codec.Audio.MP3.Mad
  import qualified Data.ByteString.Lazy as B
  import System
  import System.IO
 
  main :: IO ()
  main = do files - getArgs
mapM_ playFile files
 
  playFile :: String - IO ()
  playFile file =
  withBinaryFile file ReadMode $ \ inHandle -
 do xs  - B.hGetContents inHandle
samples - decode xs
play samples

 I do have a couple questions...

   * The CoreAudio library requires its users to be compiled with
 -threaded.  Is there a way to specify that in the Cabal file?

I don't think so. Actually, I asked dcoutts, and he said Cabal cannot make a 
user use a specified ghc-option:. Apparently it did once, but it was abused and 
got removed:
The only problem is that threaded applies to the final program. If a library 
declares that it needs threaded, does that mean we have to propagate the flag 
and use it with all programs that use it?

Propagating GHC flags is not possible currently - by design. GHC used to have 
such a feature and it was removed.

Or perhaps we say it's an extension that only applies to executables?
http://hackage.haskell.org/trac/hackage/ticket/26

...
 chris

--
gwern
enigma main Warfare DREC Intiso cards kilderkin Crypto Waihopai Oscor


pgpH7st3jXs1S.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: HFuse: ls fails in HelloFS

2008-03-19 Thread gwern0
On 2008.03.19 02:43:27 -0400, Brandon S. Allbery KF8NH [EMAIL PROTECTED] 
scribbled 0.8K characters:

 On Mar 19, 2008, at 2:12 , Austin Seipp wrote:

 Excerpts from Will Thompson's message of Sun Mar 16 08:37:00 -0500 2008:
 Currently the module's name is HFuse.  Presumably it really belongs
 under System somewhere; System.Posix.Fuse maybe?  What do folks think?
 Are there any guidelines for picking a namespace?

 I don't think there's any sort of doc on picking a namespace or how to
 logically name your package modules (would likely be worth writing);
 for something like this, I would say something under System.Posix.*
 would be the most appropriate.

 Erm, POSIX does not mean Linux and sufficiently similar systems.  FUSE
 is supported by open source Unixlikes, not by POSIX compliant systems in
 general.

 --
 brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]

Not sure that's a useful distinction to make. Wikipedia says FUSE is available 
for Linux, FreeBSD, NetBSD (as PUFFS), OpenSolaris and Mac OS X (as MacFUSE).

Linux, the BSDs, and Solaris are all pretty POSIX compliant, where they have 
not actually been officially certified by POSIX; OS X Leopard is surprisingly 
enough, certified - http://www.apple.com/macosx/technology/unix.html says
Leopard is an Open Brand UNIX 03 Registered Product, conforming to the SUSv3 
and POSIX 1003.1 specifications for the C API, Shell Utilities, and Threads. 
Since Leopard can compile and run all your existing UNIX code, you can deploy 
it in environments that demand full conformance — complete with hooks to 
maintain compatibility with existing software.

Since there's no Filesystem.* hierarchy, what's wrong with System.Posix.FUSE.*? 
I know of no non-Posix systems that run FUSE...

--
gwern
enigma main Warfare DREC Intiso cards kilderkin Crypto Waihopai Oscor


pgpcfkv27PFZf.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Error handling in calculations

2008-03-19 Thread hjgtuyl


L.S.,

When playing with exceptions, I noticed the following strangeness:
  *Main 1 / 0
  Infinity
  *Main 1 `div` 0
  *** Exception: divide by zero

This is in GHCi 6.8.2; WinHugs Sep 2006 gives:
  Main 1 / 0
  1.#INF
  Main 1 `div` 0

  Program error: divide by zero

Is this difference between fractional and integral calculation  
intentional? It makes error handling more difficult.


--
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--

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


Re: [Haskell-cafe] Error handling in calculations

2008-03-19 Thread Roman Cheplyaka
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2008-03-19 21:47:52+0100]

 L.S.,

 When playing with exceptions, I noticed the following strangeness:
   *Main 1 / 0
   Infinity
   *Main 1 `div` 0
   *** Exception: divide by zero

 This is in GHCi 6.8.2; WinHugs Sep 2006 gives:
   Main 1 / 0
   1.#INF
   Main 1 `div` 0

   Program error: divide by zero

 Is this difference between fractional and integral calculation  
 intentional? It makes error handling more difficult.

I think it's because in the first case you have floating-point overflow
(which can happen not just in case of division by 0 and means some
very-large number -- remember, you cannot distinguish 0 and 0.00..001)
and in the second case it's just division by zero -- meaningless
operation.

-- 
Roman I. Cheplyaka :: http://ro-che.info/
...being in love is totally punk rock...


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


Re: [Haskell-cafe] Re: Type parameters in type families

2008-03-19 Thread Manuel M T Chakravarty

Ryan Ingram:

On 3/17/08, Hugo Pacheco [EMAIL PROTECTED] wrote:
On the other side, it fails to compile when this signature is  
explicit:

fff :: forall d x. (FunctorF d) = d - F d x - F d x
fff a = fmapF a id


Interestingly, this works when you also give a type signature to id:

fff :: forall d x. (FunctorF d) = d - F d x - F d x
fff a = fmapF a (id :: x - x)

compiles for me (ghc6.8.2).  There's probably a bug in the type
checker; inference is working with no type signatures, but checking
fails.


The type checker is alright.  It is an issue that we need to explain  
better in the documentation, though.


As a simple example consider,

  class C a where
type F a :: *
foo :: F a

The only occurrence of 'a' here is as an argument of the type family  
F.  However, as discussed in this thread, decomposition does not hold  
for the type-indicies of a type family.  In other words, from F a ~ F  
b, we can *not* deduce a ~ b.  You have got the same situation for the  
'x' in type type of fff.


BTW, the same applies if you code the example with FDs.

  class C a ca | a - ca where
foo :: ca

which means, we have

  foo :: C a ca = ca

Here 'a' only appears in the context and as 'a' appears on the lhs of  
the FD arrow, that leads to ambiguities.


In summary, a type variable in a signature that appears *only* as part  
of type-indicies of type families leads to the same sort of  
ambiguities as a type variable that appears only in the context of a  
type signature.


Manuel

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