Re: [Haskell] Re: ANNOUNCE: HNOP 0.1

2006-06-30 Thread Christophe Poucet
I do think that refactoring this to a library would be a much better idea.  That way we can see how this scales to multithreaded applications.  Will there be a HNOP 2.0 that takes advantage of such fancy features such as MPTC or FD?  It would be interesting to see how this problem reduces when one uses these advanced Haskell features.  Perhaps as showcase to show that MPTC and FD definitely improve code-readability and design-abstraction/
Cheers,Christophe (vincenz)On 6/30/06, Ashley Yakeley <[EMAIL PROTECTED]> wrote:
In article<[EMAIL PROTECTED]>, "Bayley, Alistair" <
[EMAIL PROTECTED]> wrote:> Cool, that's awesome. But I don't see any Haddock docs? Or a Cabal> Setup.hs? Would it be much trouble to add them?
Bear in mind HNOP compiles just to an executable file, so it doesn'treally have a Haskell API.One interesting line of development would be to spin off the corefunctionality into a separate library, to provide no-op services to
other Haskell applications. I'm thinking something like this:  noop :: IO ()  -- generalise to other Monads?This would actually not be too hard to write, given my existing work,and then of course the executable would simply be a thin wrapper.
--Ashley YakeleySeattle WA___Haskell mailing listHaskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


Re: [Haskell] (.) . (.)

2006-05-28 Thread Christophe Poucet

Hello,

I think you look at the (.) . (.) as all being c's in the wrong way. You 
have to consider what will evaluate first (syntactical priority rules). 
Anyways the simplest case that this is equivalent can be seen here:

22:33 < vincenz> @pl \f g a b -> f (g a b)
22:33 < lambdabot> (.) . (.)

Writing it explicilty:
(.) f g a = f (g a)


so we get
(.) . (.) = \f -> (.) ((.) f)
(.) . (.) f = (.) ((.) f)
(.) . (.) f g = (.) ((.) f) g
(.) . (.) f g = ((.) f) . g
(.) . (.) f g a = ((.) f) (g a)
(.) . (.) f g a = (.) f (g a)
(.) . (.) f g a = f . (g a)
(.) . (.) f g a b = f . (g a) $ b
(.) . (.) f g a b = f ((g a) b)
(.) . (.) f g a b = f (g a b)

Cheers
Christophe

Brian Hulley wrote:


Brian Hulley wrote:


Taral wrote:


On 5/28/06, Dominic Steinitz <[EMAIL PROTECTED]>
wrote:


Is this defined in some library? Thanks, Dominic.



Don't think so. I use:

\a b -> f (g a b)



I don't see how (.) . (.) translates into something so simple.
Using c for (.) to make things easier to write, I get:

(.) . (.)
=== c c c
=== \x -> (c c c x)
=== \x -> (c (c x))
=== \x -> (\y z -> c (c x) y z)



Here was one error 
so fixing it and continuing:

\x -> (c (c x))
=== \x -> (\y z -> c (c x) z y)
=== \x -> (\y z -> (c x) (z y))
=== \x -> (\y z -> (\p q -> c x q p) (z y))
=== \x -> (\y z -> (\p q -> x (q p)) (z y))
=== \x -> (\y z -> (\q -> x (q (z y

=== \x y z q -> x (q (z y))

But it still doesn't match f (g a b)...

Regards, Brian.
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell




--
Christophe Poucet
Ph.D. Student
Phone:+32 16 28 87 20
E-mail: Christophe (dot) Poucet (at) imec (dot) be
Website: http://notvincenz.com/  
IMEC vzw – Register of Legal Entities Leuven VAT BE 0425.260.668 – Kapeldreef 75, B-3001 Leuven, Belgium – www.imec.be

*DISCLAIMER*
This e-mail and/or its attachments may contain confidential information. It is 
intended solely for the intended addressee(s).
Any use of the information contained herein by other persons is prohibited. 
IMEC vzw does not accept any liability for the contents of this e-mail and/or 
its attachments.
**

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


[Haskell] TypeCasting in Haskell

2006-05-24 Thread Christophe Poucet

Dear all,

I typically use indirect composite for making AST's. It allows me to 
easily make new types with other annotations without having to duplicate 
all elements but only those that actually change. It also allows a whole 
amalgam of other possibilities. Recently I have observed a type error 
which seems to be fixable only by doing a "typecast". What do I call a 
typecast, you may ask? Basically a noop that changes the type. Here 
attached you will find the code that demonstrates this.




module TypeCast where

data FooBar foo bar = --- Indirect composite
Foo { unFoo :: foo}
| Bar { unBar :: bar}

--- Assume some PFoobar (parsed)
data PFooBar = PF {unPF :: FooBar String String}
--- Assume some TFoobar (typed)
data TFooBar = TF {unTF :: FooBar Int String }

-- Merrily we write our conversion, using binding to optimize slightly
typer :: PFooBar -> TFooBar
typer pFooBar =
case unPF pFooBar of
[EMAIL PROTECTED] { unFoo = foo} -> -- We only need to change foo
TF $ f{unFoo = 1}
[EMAIL PROTECTED] { unBar = bar} -> -- We don't need to change this string
TF $ b -- So we just return b

--- Nice little main to make this a full module:
main :: IO ()
main = do
print . typer . PF . Foo $ "Hello"

--- Type error:
-- TypeCast.hs:19:11:
-- Couldn't match `Int' against `String'
-- Expected type: FooBar Int String
-- Inferred type: FooBar String String
-- In the second argument of `($)', namely `b'
-- In a case alternative: ([EMAIL PROTECTED] {unBar = bar}) -> TF $ b

--- what is the fix? Basically do a noop on b
--- [EMAIL PROTECTED] {unBar = bar} ->
--- TF $ b{unBar = bar}


Cheers,
Christophe

--
Christophe Poucet
Ph.D. Student
Phone:+32 16 28 87 20
E-mail: Christophe (dot) Poucet (at) imec (dot) be
Website: http://notvincenz.com/  
IMEC vzw – Register of Legal Entities Leuven VAT BE 0425.260.668 – Kapeldreef 75, B-3001 Leuven, Belgium – www.imec.be

*DISCLAIMER*
This e-mail and/or its attachments may contain confidential information. It is 
intended solely for the intended addressee(s).
Any use of the information contained herein by other persons is prohibited. 
IMEC vzw does not accept any liability for the contents of this e-mail and/or 
its attachments.
**

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


Re: [Haskell] GHC Hackathon

2006-05-23 Thread Christophe Poucet

Dear all,

I think the hackathon sounds like a very interesting idea, however 
unfortunately I will not be able to attend, and I have heard that other 
people from #haskell will not be able to attend either. I think many 
would be grateful if a podcast were made of this event such that those 
who missed it can still watch the presentations.


With regards,
Christophe (vincenz)

Simon Peyton-Jones wrote:


Friends,

A couple of weeks ago Simon M advertised the possibility that he and I
might run a "GHC Hackathon", in Portland, later this year prior to ICFP
(Sept 14-16 or thereabouts).  The idea is that we'd give an extended
tutorial about GHC's glorious innards.  Then we'd have some hacking time
in which you can pick something which you think GHC could do better, and
implement it, with Simon and me wandering causing trouble.  (E.g. look
at GHC's list of tasks http://hackage.haskell.org/trac/ghc/report/2, but
don't limit yourself to those.)

[snip]




--
Christophe Poucet
Ph.D. Student
Phone:+32 16 28 87 20
E-mail: [EMAIL PROTECTED]
IMEC vzw – Register of Legal Entities Leuven VAT BE 0425.260.668 – Kapeldreef 
75, B-3001 Leuven, Belgium – www.imec.be
*DISCLAIMER*
This e-mail and/or its attachments may contain confidential information. It is 
intended solely for the intended addressee(s).
Any use of the information contained herein by other persons is prohibited. 
IMEC vzw does not accept any liability for the contents of this e-mail and/or 
its attachments.
**

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