Re: [Haskell-cafe] Re: POSIX AIO (asych I/O) ...

2008-07-02 Thread Brandon S. Allbery KF8NH


On 2008 Jul 2, at 1:42, Galchin, Vasili wrote:


  errno - throwErrnoIfMinus1 aioError (c_aio_error  p_aiocb)

ghc thinks that Errno should be an instance of Num:

System/Posix/Aio.hsc:117:15:
No instance for (Num Errno)


I expect so it can compare it to -1(throwErrnoIfMinusOne).  But if the  
return value is actually an errno and not -1 to indicate error (which  
it is if I read the manpage correctly), you don't want  
throwErrnoIfMinus1 anyway; I suspect you want to wrap the return value  
of c_aio_return (which should be IO CInt) in an Errno constructor,  
then use errnoToIOError if you really want to raise an IOError.


(What were you expecting for count?  I see none, just an errno.)

Note that it *never* returns -1; it returns 0 for successful  
completion for the aiocb, EINPROGRESS if it's still working, and the  
appropriate errno if it failed.


You might want to decide if you want to use the aio_return style  
interface or something more Haskell-ish before designing this part of  
the API.  If you want to stick close to the C interface:


aioReturn :: AIOCB - IO (AIOCB, Errno)
aioReturn aiocb = do
   allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb - do
  poke p_aiocb aiocb
  err - c_aio_return  p_aiocb
  aiocb - peek p_aiocb
  return (aiocb, Errno err)

I'd actually consider something more Haskellish, e.g. a variant of  
StateT IO where the state is the aiocb and errno, the errno  
initialized to eINPROGRESS and set by aioReturn and aioError (and once  
aioReturn is called, it can't be called again so return the cached  
value if needed).


--
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: POSIX AIO (asych I/O) ...

2008-07-02 Thread Jonathan Cast
On Wed, 2008-07-02 at 02:07 -0400, Brandon S. Allbery KF8NH wrote:
 
 On 2008 Jul 2, at 1:42, Galchin, Vasili wrote:
 
errno - throwErrnoIfMinus1 aioError (c_aio_error  p_aiocb)
  
  ghc thinks that Errno should be an instance of Num:
  
  System/Posix/Aio.hsc:117:15:
  No instance for (Num Errno)
 
 
 I expect so it can compare it to -1(throwErrnoIfMinusOne).  But if the
 return value is actually an errno and not -1 to indicate error (which
 it is if I read the manpage correctly), you don't want
 throwErrnoIfMinus1 anyway; I suspect you want to wrap the return value
 of c_aio_return (which should be IO CInt) in an Errno constructor,
 then use errnoToIOError if you really want to raise an IOError.
 
 
 (What were you expecting for count?  I see none, just an errno.)
 
 
 Note that it *never* returns -1; it returns 0 for successful
 completion for the aiocb, EINPROGRESS if it's still working, and the
 appropriate errno if it failed.

It seems as though it can return -1 if given non-sensical input.  But in
that case, the nicely type-correct thing to do would still be to have
the C binding return a CInt, and wrap that after the call to
throwErrnoIfMinus1 (in this case, `errno' still refers to the global
errno, set to EINVAL).

jcc



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


Re: [Haskell-cafe] Re: POSIX AIO (asych I/O) ...

2008-07-02 Thread Brandon S. Allbery KF8NH


On 2008 Jul 2, at 2:15, Jonathan Cast wrote:

It seems as though it can return -1 if given non-sensical input.   
But in


The POSIX spec says it returns EINVAL in that case.

--
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: POSIX AIO (asych I/O) ...

2008-07-02 Thread Jonathan Cast
On Wed, 2008-07-02 at 02:17 -0400, Brandon S. Allbery KF8NH wrote:
 On 2008 Jul 2, at 2:15, Jonathan Cast wrote:
 
  It seems as though it can return -1 if given non-sensical input.   
  But in
 
 The POSIX spec says it returns EINVAL in that case.

Are you sure?  A little googling picks up e.g. HP docs [1] that state

RETURN VALUE
If the aiocb is invalid or if no asynchronous I/O operation is enqueued
for the aiocb, aio_error() returns -1 and errno is set to indicate the
error

It may be non-POSIX, but I'd like to see some verbiage for which HP/UX's
behavior isn't the most natural interpretation.

jcc

[1] http://docs.hp.com/en/B9106-90009/aio_error.2.html

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


Re: [Haskell-cafe] Re: POSIX AIO (asych I/O) ...

2008-07-02 Thread Galchin, Vasili
Thanks, Brandon!! I understand most of what you say but let me ponder!

Kind regards, Vasili

On Wed, Jul 2, 2008 at 1:07 AM, Brandon S. Allbery KF8NH 
[EMAIL PROTECTED] wrote:


 On 2008 Jul 2, at 1:42, Galchin, Vasili wrote:

   errno - throwErrnoIfMinus1 aioError (c_aio_error  p_aiocb)

 ghc thinks that Errno should be an instance of Num:

 System/Posix/Aio.hsc:117:15:
 No instance for (Num Errno)


 I expect so it can compare it to -1(throwErrnoIfMinusOne).  But if the
 return value is actually an errno and not -1 to indicate error (which it is
 if I read the manpage correctly), you don't want throwErrnoIfMinus1 anyway;
 I suspect you want to wrap the return value of c_aio_return (which should be
 IO CInt) in an Errno constructor, then use errnoToIOError if you really want
 to raise an IOError.

 (What were you expecting for count?  I see none, just an errno.)

 Note that it *never* returns -1; it returns 0 for successful completion for
 the aiocb, EINPROGRESS if it's still working, and the appropriate errno if
 it failed.

 You might want to decide if you want to use the aio_return style interface
 or something more Haskell-ish before designing this part of the API.  If you
 want to stick close to the C interface:

 aioReturn :: AIOCB - IO (AIOCB, Errno)
 aioReturn aiocb = do
allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb - do
   poke p_aiocb aiocb
   err - c_aio_return  p_aiocb
   aiocb - peek p_aiocb
   return (aiocb, Errno err)
 I'd actually consider something more Haskellish, e.g. a variant of StateT
 IO where the state is the aiocb and errno, the errno initialized to
 eINPROGRESS and set by aioReturn and aioError (and once aioReturn is called,
 it can't be called again so return the cached value if needed).

 --
 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: Haskell on ARM (was Re: ANN: Topkata)

2008-07-02 Thread L.Guo
Thanks for sharing your experences.

I just tried to port GHC 6.8.3 to my TI Davincci (c6446) board by
following the GHC Wiki Building/Porting page [1]. Both arm-compile
and cross-compile version have failed unfortunately.

So, I turn to try compile an local GHC on linux.
It takes me so many time.
I can not finish building it before off work.

[1] 
http://hackage.haskell.org/trac/ghc/wiki/Building/Porting#PortingGHCtoanewplatform

--   
L.Guo
2008-07-02

-
From: Jeremy Shaw
At: 2008-06-28 02:57:38
Subject: Re: [Haskell-cafe] Re: Haskell on ARM (was Re: ANN: Topkata)

Cool!

By cross-compilation, I assume you mean, a version of GHC which runs
on x86, but generates ARM assembly? Another option might be to use a
nintendo DS emulator which has been configured to support more RAM and
CPU power ?

A true cross-compiler would be nice though, because it will run much
faster. GHC does have some support for cross-compilation, but in the
current implementation, it is mostly (entirely?) there for
bootstrapping. I have no idea how the ghc backend rewrite for 6.10
will affect this.

Hope this helps,
j.
___
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] Question about abstraction

2008-07-02 Thread Bas van Dijk
Dear list,

I have I question about the following code I was playing with:
(you can past the following right into your editor)

--

import Data.Foldable   (Foldable, foldMap)
import Data.Monoid (mempty, mappend)
import Data.Traversable(Traversable, traverse)
import Control.Applicative (pure, ($), (*))

-- I was playing with the following tree-like datastructure (my plan
-- is to make some kind of kd-tree but that's not important now):

data T a = L | N C2 a (T a) (T a)
  (T a) (T a)

type C2 = (Float, Float)

-- A fold always comes in handy:

foldT :: b - (C2 - a - b - b
   - b - b - b) - T a - b
foldT e _ L = e
foldT e n (N c x tl tr
 bl br) = n c x (foldT e n tl) (foldT e n tr)
(foldT e n bl) (foldT e n br)

instance Functor T where
fmap f = foldT L (\p - N p . f)

-- Now I defined the following instances:

instance Foldable T where
foldMap f = foldT mempty $ \_ x tl tr
bl br - f x `mappend` tl `mappend` tr
 `mappend` bl `mappend` br

instance Traversable T where
traverse f = foldT (pure L) $ \p x tl tr
   bl br - N p $ f x * tl * tr
* bl * br

--

-- If you look at the previous two functions you see a similar pattern:
-- they both combine an initial value:  'f x'  and  'N p $ f x'  respectively
-- with the childs using a combining function:  'mappend'  and  '*'
respectively.

-- My question is: can I abstract from that?

-- It looks like I can using a function like:

combineWith :: b - (b - a - b) - a - a
  - a - a - b
n `combineWith` f = \tl tr
 bl br - n `f` tl `f` tr
`f` bl `f` br

-- Now 'foldMap' becomes:

instance Foldable T where
foldMap f = foldT mempty $ \_ x - f x `combineWith` mappend

-- But 'traverse' won't typecheck:

instance Traversable T where
traverse f = foldT (pure L) $ \p x - (N p $ f x) `combineWith` (*)

-- Is it possible to make 'combineWith' more general so that the
-- previous typechecks (maybe using arbitrary-rank polymorphism but I
-- don't see how)?

--

Thanks,

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


Re: [Haskell-cafe] Re: POSIX AIO (asych I/O) ...

2008-07-02 Thread Brandon S. Allbery KF8NH


On 2008 Jul 2, at 2:32, Jonathan Cast wrote:


On Wed, 2008-07-02 at 02:17 -0400, Brandon S. Allbery KF8NH wrote:

On 2008 Jul 2, at 2:15, Jonathan Cast wrote:


It seems as though it can return -1 if given non-sensical input.
But in


The POSIX spec says it returns EINVAL in that case.


Are you sure?  A little googling picks up e.g. HP docs [1] that state



Hm.  I think the manuals I was looking at are ambiguous on the point,  
and I can't get at the actual standard right now.  Probably best to  
assume -1/EINVAL is a possible return value, then.


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


[Haskell-cafe] Re: A Monad for on-demand file generation?

2008-07-02 Thread ChrisK

hen, the readFileOD could put the timestamp
of the read file in a Monad-local state and the writeFileOD could, if
the output is newer then all inputs listed in the state, skip the
writing and thus the unsafeInterleaveIO’ed file reads are skipped as
well, if they were not required for deciding the flow of the program.


How is your system similar to make/Makefile or different to
make/Makefile ?

Are your actions more restricted?  Are the semantics more imperative?  Are the 
dependencies still explicit or are them implicit and inferred?


--
Chris

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


[Haskell-cafe] Unboxed array of product type - product type of unboxed arrays

2008-07-02 Thread Scott Dillard
Hi,

I'm trying to extended the standard unboxed array types and array classes to
my own product types, for now let's just say (,). So if the proper MArray
and IArray instances exist for e and f, then I can make an instance for
(e,f). The actual type of that array, something like (UArray i e, UArray i
f), would be given by an associated type. This is how the uvector library
does it, but that library defines its own array primitives and classes. I'd
like to reuse the standard ones if possible.

The problem I keep running into is the kind of the array, * - * - *, or 'a
i e'. The crucial type there is e, which is used to dispatch the instance to
the proper associated type, so if e = (a,b) then the array type would be
(UArray i a, UArray I b), and if e is (a,b,c) then (UArray i a, UArray i b,
UArray i c). If IArray was instead expecting the array type to be 'a e i' I
could maybe do something like this:

class UArrClass e where
  data UArr e :: * - *
instance (IArray UArray e, IArray UArray f) = UArrClass (e,f) where
  data UArr (e,f) i = UArrPair (UArray i e) (UArray i f)

But as it stands, I can't do that. The 'i' type parameter has to be bound as
a parameter of UArrClass. So instead I tried this.

class UArrClass i e where
  data UArr i e
  unsafeAt_ :: UArr i e - Int - e
  --mirror all IArray methods

instance
( IArray UArray e
, IArray UArray f
, Ix i  --needed for unsafeAt
) = UArrClass i (e,f)
  where
newtype UArr i (e,f) = UArrPair (UArray i e) (UArray i f)
unsafeAt_ (UArrPair ea fa) i = (unsafeAt ea i , unsafeAt fa i)

and then the instance for IArray could be defined as follows, just a mapping
from the methods of that class onto my own:

instance
( IArray UArray e
, IArray UArray f
, UArrClass i (e,f)
) = IArray UArr (e,f)
  where
unsafeAt = unsafeAt_

The problem I get now is from the 'Ix i' context of the IArray methods. The
'i' there is only mentioned in the context of the methods, not the class, so
I have no 'handle' onto that 'i' that I can use to explicitly unify it with
the 'i' mentioned in UArrClass. The compiler keeps complaining about rigid
type variables. It would be great if I could leave that type variable
unbound in my class, and only bind it in the methods, as IArray does, but as
far as I can tell, I can't. I need to bind 'i' in my class because it's the
first type-argument to the array type constructor, rather than the second. I
don't care about the 'i', its the 'e' I'm after, but all applications of the
associated type constructor need to be saturated.

Can anyone see a way to do this? I understand there's about a million other
ways to accomplish what I'm trying to do without IArray and MArray, but I'm
just wondering if I should abandon those classes altogether, and use my own
array classes, using something like uvector or unsafeIO/ForeignPtr. That
seems to be trend.

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


Re: [Haskell-cafe] Re: Haskell on ARM (was Re: ANN: Topkata)

2008-07-02 Thread Don Stewart
Could we start documenting this on the wiki ?

It will be interesting to keep track of what we have tried,
what attempts failed and why.

-- Don

leaveye.guo:
 Thanks for sharing your experences.
 
 I just tried to port GHC 6.8.3 to my TI Davincci (c6446) board by
 following the GHC Wiki Building/Porting page [1]. Both arm-compile
 and cross-compile version have failed unfortunately.
 
 So, I turn to try compile an local GHC on linux.
 It takes me so many time.
 I can not finish building it before off work.
 
 [1] 
 http://hackage.haskell.org/trac/ghc/wiki/Building/Porting#PortingGHCtoanewplatform
 
 -- 
 L.Guo
 2008-07-02
 
 -
 From: Jeremy Shaw
 At: 2008-06-28 02:57:38
 Subject: Re: [Haskell-cafe] Re: Haskell on ARM (was Re: ANN: Topkata)
 
 Cool!
 
 By cross-compilation, I assume you mean, a version of GHC which runs
 on x86, but generates ARM assembly? Another option might be to use a
 nintendo DS emulator which has been configured to support more RAM and
 CPU power ?
 
 A true cross-compiler would be nice though, because it will run much
 faster. GHC does have some support for cross-compilation, but in the
 current implementation, it is mostly (entirely?) there for
 bootstrapping. I have no idea how the ghc backend rewrite for 6.10
 will affect this.
 
 Hope this helps,
 j.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unboxed array of product type - product type of unboxed arrays

2008-07-02 Thread Daniel Fischer
Am Mittwoch, 2. Juli 2008 18:48 schrieb Scott Dillard:
 Hi,

 I'm trying to extended the standard unboxed array types and array classes
 to my own product types, for now let's just say (,). So if the proper
 MArray and IArray instances exist for e and f, then I can make an instance
 for (e,f). The actual type of that array, something like (UArray i e,
 UArray i f), would be given by an associated type. This is how the uvector
 library does it, but that library defines its own array primitives and
 classes. I'd like to reuse the standard ones if possible.

 The problem I keep running into is the kind of the array, * - * - *, or
 'a i e'. The crucial type there is e, which is used to dispatch the
 instance to the proper associated type, so if e = (a,b) then the array type
 would be (UArray i a, UArray I b), and if e is (a,b,c) then (UArray i a,
 UArray i b, UArray i c). If IArray was instead expecting the array type to
 be 'a e i' I could maybe do something like this:

 class UArrClass e where
   data UArr e :: * - *
 instance (IArray UArray e, IArray UArray f) = UArrClass (e,f) where
   data UArr (e,f) i = UArrPair (UArray i e) (UArray i f)

 But as it stands, I can't do that. The 'i' type parameter has to be bound
 as a parameter of UArrClass. So instead I tried this.

 class UArrClass i e where
   data UArr i e
   unsafeAt_ :: UArr i e - Int - e
   --mirror all IArray methods

Perhaps

class (Ix i) = UArrClass i e where ...

would work?


 instance
 ( IArray UArray e
 , IArray UArray f
 , Ix i  --needed for unsafeAt
 ) = UArrClass i (e,f)
   where
 newtype UArr i (e,f) = UArrPair (UArray i e) (UArray i f)
 unsafeAt_ (UArrPair ea fa) i = (unsafeAt ea i , unsafeAt fa i)

 and then the instance for IArray could be defined as follows, just a
 mapping from the methods of that class onto my own:

 instance
 ( IArray UArray e
 , IArray UArray f
 , UArrClass i (e,f)
 ) = IArray UArr (e,f)
   where
 unsafeAt = unsafeAt_

 The problem I get now is from the 'Ix i' context of the IArray methods. The
 'i' there is only mentioned in the context of the methods, not the class,
 so I have no 'handle' onto that 'i' that I can use to explicitly unify it
 with the 'i' mentioned in UArrClass. The compiler keeps complaining about
 rigid type variables. It would be great if I could leave that type variable
 unbound in my class, and only bind it in the methods, as IArray does, but
 as far as I can tell, I can't. I need to bind 'i' in my class because it's
 the first type-argument to the array type constructor, rather than the
 second. I don't care about the 'i', its the 'e' I'm after, but all
 applications of the associated type constructor need to be saturated.

 Can anyone see a way to do this? I understand there's about a million other
 ways to accomplish what I'm trying to do without IArray and MArray, but I'm
 just wondering if I should abandon those classes altogether, and use my own
 array classes, using something like uvector or unsafeIO/ForeignPtr. That
 seems to be trend.

 Thanks,
 Scott

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


Re: [Haskell-cafe] Unboxed array of product type - product type of unboxed arrays

2008-07-02 Thread Scott Dillard
On Wed, Jul 2, 2008 at 11:52 AM, Daniel Fischer [EMAIL PROTECTED]
wrote:


 Perhaps

 class (Ix i) = UArrClass i e where ...

 would work?


class Ix i = UArrClass i e where
  data UArr i e
  unsafeAt_ :: UArr i e - Int - e

instance
( IArray UArray e
, IArray UArray f
, Ix i
) = UArrClass i (e,f)
  where
newtype UArr i (e,f) = UArrPair (UArray i e) (UArray i f)
unsafeAt_ (UArrPair ea fa) i = (unsafeAt ea i , unsafeAt fa i)

instance
( IArray UArray e
, IArray UArray f
, UArrClass i (e,f)
, Ix i
) = IArray UArr (e,f)
  where
unsafeAt = unsafeAt_

test1 :: UArr Int (Int,Int) - (Int,Int)
test1 a = unsafeAt a 5   --this is line 77


Array.hs:77:10:
Ambiguous type variable `i' in the constraint:
  `Ix i' arising from a use of `unsafeAt' at Array.hs:77:10-21
Probable fix: add a type signature that fixes these type variable(s)

I think the 'i' there is the one from the method context of IArray,

class IArray a e where
   unsafeAt :: Ix i = a i e - Int - e

But that 'i' does not escape to the class context, so I have no way to
address it. I think I need to leave it free, but I can't do that with my
associated type.

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


[Haskell-cafe] GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Greg Fitzgerald
It may not be long before most of the computing world has gone mobile.  CNET
suggests the major players will be Qualcomm and Intel, where QC is more
power-efficient, but Intel conveniently targets x86.

June 29, 2008 7:30 PM PDT
Qualcomm vs Intel: You
decide%20http://news.cnet.com/8301-13924_3-9979989-64.html

I'm a software engineer at Qualcomm with a desire to code more Haskell at
work.  This desire will only get stronger in coming years as multithreaded
apps on mobile devices get more popular, and ways to write them reliably in
traditional languages continue not to exist.


Jeremy Shaw said:
 Perhaps we should have some sort of GHC on the ARM hackathon
 when 6.10 comes out

Would anybody be interested in a GHC on ARM Hackathon in San Diego this
year?

When is 6.10 estimated to come out?  Do we really need to wait for it?


Jeremy Apthorp said:
 it'll also require that I significantly strip down the runtime system, as
 the current RTS won't fit in 4M

Do you have a plan for how to do this?  Maybe we can invite a Simon to teach
us the innards of the RTS and help guide us?


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


[Haskell-cafe] Re: GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Greg Fitzgerald
...try that hyperlink again...

Qualcomm vs Intel: You decide
http://news.cnet.com/8301-13924_3-9979989-64.html

On Wed, Jul 2, 2008 at 11:16 AM, Greg Fitzgerald [EMAIL PROTECTED] wrote:

 It may not be long before most of the computing world has gone mobile.
 CNET suggests the major players will be Qualcomm and Intel, where QC is more
 power-efficient, but Intel conveniently targets x86.

 June 29, 2008 7:30 PM PDT
 Qualcomm vs Intel: You decide

 I'm a software engineer at Qualcomm with a desire to code more Haskell at
 work.  This desire will only get stronger in coming years as multithreaded
 apps on mobile devices get more popular, and ways to write them reliably in
 traditional languages continue not to exist.


 Jeremy Shaw said:
  Perhaps we should have some sort of GHC on the ARM hackathon
  when 6.10 comes out

 Would anybody be interested in a GHC on ARM Hackathon in San Diego this
 year?

 When is 6.10 estimated to come out?  Do we really need to wait for it?


 Jeremy Apthorp said:
  it'll also require that I significantly strip down the runtime system, as
  the current RTS won't fit in 4M

 Do you have a plan for how to do this?  Maybe we can invite a Simon to
 teach us the innards of the RTS and help guide us?


 Thanks,
 Greg


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


[Haskell-cafe] Re: GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Jeremy Shaw
At Wed, 2 Jul 2008 11:16:18 -0700,
Greg Fitzgerald wrote:

 Would anybody be interested in a GHC on ARM Hackathon in San Diego this
 year?

Definitely. (Conveniently, I live in La Jolla).

 When is 6.10 estimated to come out?  Do we really need to wait for it?

According to this Release plan, the plan to release 6.10 around ICFP2008. 

http://hackage.haskell.org/trac/ghc/wiki/Status/Releases

We wouldn't need a final release to get started, just something where
the back-end changes are in place and working. One important item from
the release plan is:

 * GHC now uses libffi to implement parts of the FFI, replacing some
   of the home-grown and very architecture-specific code we had to do
   this. Amongst other benefits, this will ease the task of porting
   GHC in the future.

And possibly:

 * Substantial changes to the back end are likely, now that John Dias
   is here as an intern. John Dias, Simon PJ, Norman Ramsey

It sounds like the changes to libffi might already be in 6.9. So,
maybe we can start now ?

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


[Haskell-cafe] Re: GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Braden Shepherdson

Jeremy Shaw wrote:

At Wed, 2 Jul 2008 11:16:18 -0700,
Greg Fitzgerald wrote:


Would anybody be interested in a GHC on ARM Hackathon in San Diego this
year?


Definitely. (Conveniently, I live in La Jolla).


When is 6.10 estimated to come out?  Do we really need to wait for it?


According to this Release plan, the plan to release 6.10 around ICFP2008. 


http://hackage.haskell.org/trac/ghc/wiki/Status/Releases

We wouldn't need a final release to get started, just something where
the back-end changes are in place and working. One important item from
the release plan is:

 * GHC now uses libffi to implement parts of the FFI, replacing some
   of the home-grown and very architecture-specific code we had to do
   this. Amongst other benefits, this will ease the task of porting
   GHC in the future.

And possibly:

 * Substantial changes to the back end are likely, now that John Dias
   is here as an intern. John Dias, Simon PJ, Norman Ramsey

It sounds like the changes to libffi might already be in 6.9. So,
maybe we can start now ?

j.



Unfortunately that's a bit of a reach for me; I live in southern Ontario 
and will be in New York City from September to December. So, I will 
likely be unable to attend, though I'll certainly see if I can pull it 
off. I'd be paying out of pocket for the travel, unfortunately.


I definitely want to contribute what I can to this project, both because 
I want its result and because I want to learn more about GHC and the RTS.


As to waiting for 6.10, I won't be able to contribute much work here 
before late August anyway, by which point much of 6.10 will likely be 
solidified in the HEAD 6.9. Certainly there are experiments and other 
parts of the project that can be worked on while waiting for the 6.10 
release in late September.


I'll post the results of any experiments and any thoughts in the 
GHC-on-ARM wiki. Notably, a page on what devices the developers have 
comes to mind.



Braden Shepherdson
shepheb

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


[Haskell-cafe] Haskell Weekly News: Issue 75 - July 2, 2008

2008-07-02 Thread Brent Yorgey
---
Haskell Weekly News
http://sequence.complete.org/hwn/20080702
Issue 75 - July 02, 2008
---

   Welcome to issue 75 of HWN, a newsletter covering developments in the
   [1]Haskell community.

Announcements

   Anglo Haskell 2008. Matthew Sackman [2]announced [3]AngloHaskell 2008,
   a gathering of all people Haskell-related from beginners, to seasoned
   hackers to academic giants. All and more are welcomed by large fuzzy
   green lambdas. The proposed dates and location are Friday the 8th and
   Saturday the 9th of August, at Imperial College, London.

   CFP - Special Issue of Fundamenta Informaticae on Dependently Typed
   Programming. Wouter Swierstra [4]announced a call for papers for a
   special issue of [5]Fundamenta Informaticae on [6]Dependently Typed
   Programming. The deadline for submissions is October 1.

   Gtk2Hs 0.9.13. Peter Gavin [7]announced the release of Gtk2Hs 0.9.13,
   including bindings for Gnome VFS and GStreamer, a new Gtk+ tutorial
   adapted by Hans van Thiel, cairo image stride support, and more.

   Hasim. Jochem Berndsen [8]announced Hasim, a [9]small project to create
   a library to do discrete event simulation in Haskell, using monads to
   define a domain-specific language for actions of a process.

   Galois move. Don Stewart [10]announced that Galois has completed the
   move of its data center. Expect speedier response times for
   hackage.haskell.org and darcs.haskell.org.

Google Summer of Code

   Progress updates from participants in the 2008 [11]Google Summer of
   Code.

   Hoogle 4. Neil Mitchell (ndm) is working on [12]Hoogle 4. [13]This
   week, Neil worked on better Haddock database generation, lazy name
   searching, and a snazzy --info flag for Hoogle. Next up: type search!

   DPH physics engine. Roman Cheplyaka (Feuerbach) is working on a
   [14]physics engine using [15]Data Parallel Haskell. [16]This week, he
   worked on implementing Mirtich's V-Clip algorithm for collision
   detection (and [17]got it to work), cabalized his project and added
   documentation. He also ran into an interesting QuickCheck puzzle.

   Generic tries. Jamie Brandon is working on a library for efficient maps
   using generalized tries. [18]This week, he created a generic framework
   for automatically running QuickCheck tests at a number of different
   types. This week he plans to synthesize the many suggestions from the
   [19]discussion on the libraries list into a stable API design.

   Language.C. Benedikt Huber (visq) is [20]working on Language.C, a
   standalone parser/pretty printer library for C99. [21]This week he
   worked on a better representation for declarators, and abstracted the
   notion of an InputStream over both String and ByteString, among other
   accomplishments.

   GHC plugins. Max Bolingbroke is working on dynamically loaded plugins
   for GHC.

   Cabal dependency framework. Andrea Vezzosi (Saizan) is working on a
   [22]make-like dependency analysis framework for Cabal.

   GHC API. Thomas Schilling (nominolo) is working on [23]improvements to
   the GHC API. Officials at HWN headquarters have released a statement
   reversing their previous position regarding the existence of Thomas,
   citing regrettably faulty information to explain their previous
   misapprehensions. Expect to hear more from Thomas soon, now that he has
   finished graduating and moving.

Libraries

   Proposals and extensions to the [24]standard libraries.

   GetOpt formatting improvements. Duncan Coutts [25]proposed some
   modifications to make the output of the System.Console.GetOpt library
   more readable, resulting in quite a bit of discussion.

   HughesPJ improvements. Benedikt Huber [26]proposed a patch with some
   bug fixes, performance improvements, and QuickCheck test suite for the
   Text.PrettyPrint.HughesPJ pretty-printing library.

Discussion

   A Monad for on-demand file generation?. Joachim Breitner [27]asked
   about a monad for transparently tracking files which may need to be
   regenerated due to dependencies, leading to an interesting discussion
   of incremental computation, strict vs. lazy I/O, and other issues.

   New mailing list proposal: Haskell-Edu. Benjamin L. Russell sent out a
   message [28]proposing a new mailing list hosted at haskell.org,
   Haskell-Edu: The Haskell Educational Mailing List. The new mailing
   list would be guided by the principle that Haskell is useful not just
   in research, but also in teaching programming as part of a liberal arts
   education. Comments and discussion welcomed.

   Learning GADT types to simulate dependent types. Paul Johnson is trying
   to use GADTs to simulate aspects of a dependently typed system, and
   [29]asks for help improving his Oleg rating.

   Call graph tool?. C.M.Brown [30]asked whether there is a tool for
   visualizing the call

[Haskell-cafe] database 101 question

2008-07-02 Thread Galchin, Vasili
Hello,

I have installed the mysql server (mysqld) on my Ubuntu machine. What
are the Haskell libraries/components that I will need to write a mysql
client??

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


[Haskell-cafe] calling setWMHints (expects a CInt, I have an Int)

2008-07-02 Thread Martin DeMello
Could someone give me an example of calling setWMHints from
Graphics.X11.Xlib.Extras? The signature is

setWMHints :: Display - Window - WMHints - IO Status

and WMHints is defined as

data WMHints = WMHints {
wmh_flags :: CLong
wmh_input :: Bool
wmh_initial_state :: CInt
wmh_icon_pixmap :: Pixmap
wmh_icon_window :: Window
wmh_icon_x :: CInt
wmh_icon_y :: CInt
wmh_icon_mask :: Pixmap
wmh_window_group :: XID
}

I can't figure out how to convert an Int to a CInt to construct the WMHints

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


Re: [Haskell-cafe] calling setWMHints (expects a CInt, I have an Int)

2008-07-02 Thread Neil Mitchell
Hi Martin,

  I can't figure out how to convert an Int to a CInt to construct the WMHints

Ask Hoogle:

http://haskell.org/hoogle/?q=Int+-%3E+CInt

And Hoogle says:

toEnum, fromIntegral

Thanks

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


Re: [Haskell-cafe] calling setWMHints (expects a CInt, I have an Int)

2008-07-02 Thread Martin DeMello
On Wed, Jul 2, 2008 at 2:16 PM, Neil Mitchell [EMAIL PROTECTED] wrote:
 Hi Martin,

  I can't figure out how to convert an Int to a CInt to construct the WMHints

 Ask Hoogle:

 http://haskell.org/hoogle/?q=Int+-%3E+CInt

Nice

 And Hoogle says:

 toEnum, fromIntegral

thanks a lot :)

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


Re: [Haskell-cafe] database 101 question

2008-07-02 Thread Don Stewart
vigalchin:
Hello,
 
I have installed the mysql server (mysqld) on my Ubuntu machine. What
are the Haskell libraries/components that I will need to write a mysql
client??

Check on hackage.haskell.org under the 'database' category.

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


Re: [Haskell-cafe] database 101 question

2008-07-02 Thread Galchin, Vasili
Hi Don,

 I know where to look but I am knew to database architecture. I know
there is a driver (whatever that is ... I write device drivers but this is
obviously different), backend ??? My question is more generic about what
pieces I would need for evenr sqlite3 for example.

Vasil

On Wed, Jul 2, 2008 at 5:03 PM, Don Stewart [EMAIL PROTECTED] wrote:

 vigalchin:
 Hello,
 
 I have installed the mysql server (mysqld) on my Ubuntu machine.
 What
 are the Haskell libraries/components that I will need to write a mysql
 client??

 Check on hackage.haskell.org under the 'database' category.

 -- Don

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


[Haskell-cafe] GHC ARM Hackathon (Re: Haskell on ARM )

2008-07-02 Thread Jeremy Apthorp
2008/7/3 Greg Fitzgerald [EMAIL PROTECTED]:
 Perhaps we should have some sort of GHC on the ARM hackathon
 when 6.10 comes out

 Would anybody be interested in a GHC on ARM Hackathon in San Diego this
 year?

I'd be interested, but I live in Sydney, Australia. San Diego's a bit
of a stretch :)

 Jeremy Apthorp said:
 it'll also require that I significantly strip down the runtime system, as
 the current RTS won't fit in 4M

 Do you have a plan for how to do this?  Maybe we can invite a Simon to teach
 us the innards of the RTS and help guide us?

I've discussed it briefly with chak (who'll be supervising the
project), but as I said, I haven't looked too deeply into the code
yet.

Jeremy



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


[Haskell-cafe] type classes

2008-07-02 Thread Cotton Seed
Hi everyone,

I'm working on a computational algebra program and I've run into a problem.
In my program, I have types for instances of algebraic objects, e.g. ZModN
for modular integers, and types for the objects themselves, e.g. ZModNTy for
the ring of modular integers.

Now, I want to subclass ZModNTy from something like

class RingTy a b where
  order :: a - Integer
  units :: a - [b]

where `a' represents algebraic object, and `b' the type of instances of that
object.  I want an instance

instance RingTy ZModNTy ZModN where ...

but then code that only uses order fails with errors like

No instance for (RingTy ZModNTy b)
  arising from a use of `order' at Test2.hs:16:8-15

since there is no constraint on the second type variable.

I think what I really want is

class RingTy a where
  order :: a b - Integer
  units :: a b - [b]

but this doesn't work either since ZModNTy is not parametric in its type
like, say, `Polynomial a' is.

Is this a common problem?  Is there a standard way to handle it?

Thank you for your attention,

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


Re: [Haskell-cafe] type classes

2008-07-02 Thread Dan Doel
On Wednesday 02 July 2008, Cotton Seed wrote:
 Hi everyone,

 I'm working on a computational algebra program and I've run into a problem.
 In my program, I have types for instances of algebraic objects, e.g. ZModN
 for modular integers, and types for the objects themselves, e.g. ZModNTy
 for the ring of modular integers.

 Now, I want to subclass ZModNTy from something like

 class RingTy a b where
   order :: a - Integer
   units :: a - [b]

 where `a' represents algebraic object, and `b' the type of instances of
 that object.  I want an instance

 instance RingTy ZModNTy ZModN where ...

 but then code that only uses order fails with errors like

 No instance for (RingTy ZModNTy b)
   arising from a use of `order' at Test2.hs:16:8-15

 since there is no constraint on the second type variable.

 I think what I really want is

 class RingTy a where
   order :: a b - Integer
   units :: a b - [b]

 but this doesn't work either since ZModNTy is not parametric in its type
 like, say, `Polynomial a' is.

 Is this a common problem?  Is there a standard way to handle it?

Correct me if I'm wrong, but wouldn't the a uniquely determine the b? In that 
case, you'd probably want a functional dependency:

  class RingTy a b | a - b where
order :: a - Integer
units :: a - [b]

This solves the problem with order, because with multi-parameter type classes, 
all the variables should be determined for a use of a method. Since b is not 
involved with order, it could be anything, so it's rather ambiguous. The 
functional dependency solves this by uniquely determined b from a, so order 
is no longer ambiguous.

Alternately, with the new type families, this can become:

  class RingTy a where
type RingElem a :: *
order :: a - Integer
units :: a - [RingElem a]

Or something along those lines.

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


Re: [Haskell-cafe] type classes

2008-07-02 Thread Cotton Seed
Hi Dan,

Thanks!  This is exactly what I was looking for.

Cotton

On Wed, Jul 2, 2008 at 9:57 PM, Dan Doel [EMAIL PROTECTED] wrote:

 On Wednesday 02 July 2008, Cotton Seed wrote:
  Hi everyone,
 
  I'm working on a computational algebra program and I've run into a problem.
  In my program, I have types for instances of algebraic objects, e.g. ZModN
  for modular integers, and types for the objects themselves, e.g. ZModNTy
  for the ring of modular integers.
 
  Now, I want to subclass ZModNTy from something like
 
  class RingTy a b where
order :: a - Integer
units :: a - [b]
 
  where `a' represents algebraic object, and `b' the type of instances of
  that object.  I want an instance
 
  instance RingTy ZModNTy ZModN where ...
 
  but then code that only uses order fails with errors like
 
  No instance for (RingTy ZModNTy b)
arising from a use of `order' at Test2.hs:16:8-15
 
  since there is no constraint on the second type variable.
 
  I think what I really want is
 
  class RingTy a where
order :: a b - Integer
units :: a b - [b]
 
  but this doesn't work either since ZModNTy is not parametric in its type
  like, say, `Polynomial a' is.
 
  Is this a common problem?  Is there a standard way to handle it?

 Correct me if I'm wrong, but wouldn't the a uniquely determine the b? In that
 case, you'd probably want a functional dependency:

  class RingTy a b | a - b where
order :: a - Integer
units :: a - [b]

 This solves the problem with order, because with multi-parameter type classes,
 all the variables should be determined for a use of a method. Since b is not
 involved with order, it could be anything, so it's rather ambiguous. The
 functional dependency solves this by uniquely determined b from a, so order
 is no longer ambiguous.

 Alternately, with the new type families, this can become:

  class RingTy a where
type RingElem a :: *
order :: a - Integer
units :: a - [RingElem a]

 Or something along those lines.

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


Re: [Haskell-cafe] Re: POSIX AIO (asych I/O) ...

2008-07-02 Thread Galchin, Vasili
Hi Brandon,

 Most of what you say makes sense. However, at some places in your
narrative aren't you mixing up my aioError and aioReturn?(or aio_error and
aio_return, respectively). E.g. aioReturn should return the byte count and
not errno?

  If you want to stick close to the C interface:
aioReturn :: AIOCB - IO (AIOCB, Errno)
aioReturn aiocb = do
   allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb - do
  poke p_aiocb aiocb
  err - c_aio_return  p_aiocb
  aiocb - peek p_aiocb
  return (aiocb, Errno err)


Vasili

On Wed, Jul 2, 2008 at 1:07 AM, Brandon S. Allbery KF8NH 
[EMAIL PROTECTED] wrote:


 On 2008 Jul 2, at 1:42, Galchin, Vasili wrote:

   errno - throwErrnoIfMinus1 aioError (c_aio_error  p_aiocb)

 ghc thinks that Errno should be an instance of Num:

 System/Posix/Aio.hsc:117:15:
 No instance for (Num Errno)


 I expect so it can compare it to -1(throwErrnoIfMinusOne).  But if the
 return value is actually an errno and not -1 to indicate error (which it is
 if I read the manpage correctly), you don't want throwErrnoIfMinus1 anyway;
 I suspect you want to wrap the return value of c_aio_return (which should be
 IO CInt) in an Errno constructor, then use errnoToIOError if you really want
 to raise an IOError.

 (What were you expecting for count?  I see none, just an errno.)

 Note that it *never* returns -1; it returns 0 for successful completion for
 the aiocb, EINPROGRESS if it's still working, and the appropriate errno if
 it failed.

 You might want to decide if you want to use the aio_return style interface
 or something more Haskell-ish before designing this part of the API.  If you
 want to stick close to the C interface:

 aioReturn :: AIOCB - IO (AIOCB, Errno)
 aioReturn aiocb = do
allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb - do
   poke p_aiocb aiocb
   err - c_aio_return  p_aiocb
   aiocb - peek p_aiocb
   return (aiocb, Errno err)
 I'd actually consider something more Haskellish, e.g. a variant of StateT
 IO where the state is the aiocb and errno, the errno initialized to
 eINPROGRESS and set by aioReturn and aioError (and once aioReturn is called,
 it can't be called again so return the cached value if needed).

 --
 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] database 101 question

2008-07-02 Thread Henning Thielemann


On Wed, 2 Jul 2008, Galchin, Vasili wrote:


Hi Don,

I know where to look but I am knew to database architecture. I know
there is a driver (whatever that is ... I write device drivers but this is
obviously different), backend ??? My question is more generic about what
pieces I would need for evenr sqlite3 for example.


As far as I understand you need either Takusen, HSQL or HDBC for database 
access. Additionally you need some of the driver packages for the 
corresponding main package. Due to package dependencies it should be 
enough to

   cabal install hsql-sqlite3
  or
   cabal install HDBC-sqlite3

With these packages you have to write your queries in SQL. If you want a 
nice monadic interface you may

   cabal install haskelldb-hdbc-sqlite3
  or
   cabal install haskelldb-hsql-sqlite3

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


Re: [Haskell-cafe] type classes

2008-07-02 Thread Henning Thielemann


On Wed, 2 Jul 2008, Cotton Seed wrote:


Hi everyone,

I'm working on a computational algebra program and I've run into a problem.
In my program, I have types for instances of algebraic objects, e.g. ZModN
for modular integers, and types for the objects themselves, e.g. ZModNTy for
the ring of modular integers.


Maybe you are also interested in:
  http://darcs.haskell.org/numericprelude/src/Number/ResidueClass.hs
  http://darcs.haskell.org/numericprelude/src/Number/ResidueClass/

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