Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Ivan Miljenovic
On 25 May 2010 16:12, Magicloud Magiclouds
 wrote:
> Yes, this code works with a little hack. Thank you.

I'm scared to ask: what pray tell is this little hack?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
Yes, this code works with a little hack. Thank you.

On Tue, May 25, 2010 at 11:06 AM, Daniel Fischer
 wrote:
> On Tuesday 25 May 2010 04:26:07, Ivan Miljenovic wrote:
>> On 25 May 2010 12:20, Magicloud Magiclouds
>>
>>  wrote:
>> > This is the function. The problem sure seems like something was
>> > preserved unexpected. But I cannot find out where is the problem.
>> >
>> > seperateOutput file =
>> >  let content = lines file
>> >      indexOfEachOutput_ = fst $ unzip $ filter (\(i, l) ->
>> >                                                 " Log for "
>> > `isPrefixOf` l ) $ zip [0..] content indexOfEachOutput =
>> > indexOfEachOutput_ ++ [length content] in
>>
>>      
>>
>>      Expensive bit
>>
>> >  map (\(a, b) ->
>> >         drop a $ take b content
>> >      ) $ zip indexOfEachOutput $ tail indexOfEachOutput
>>
>> You're not "streaming" the String; you're also keeping it around to
>> calculate the length (I'm also not sure how GHC optimises that if at
>> all; it might even re-evaluate the length each time you use
>> indexOfEachOutput.
>
> Not that it helps, but it evaluates the length only once.
> But it does that at the very end, when dealing with the last log.
>
>>
>> The zipping of indexOfEachOutput should be OK without that length at
>> the end, as it will lazy construct the zipped list (only evaluating up
>> to two values at a time).  However, you'd be better off using "zipWith
>> f" rather than "map f . zip".
>
> There'd still be the problem of
>
> drop a $ take b content
>
> , so nothing can be garbage collected before everything's done.
>
> separateOutpout file =
>    let contents = lines file
>        split = break ("Log for " `isPrefixOf`)
>        msplit [] = Nothing
>        msplit lns = Just (split lns)
>    in drop 1 $ unfoldr msplit contents
>
> should fix it.
>
>



-- 
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: atom-1.0.4

2010-05-24 Thread Tom Hawkins
On Mon, May 24, 2010 at 2:34 AM, Graham Klyne  wrote:
> I think this looks like an interesting idea... can you provide a pointer to
> a description of the DSL/API itself?

Unfortunately, there's not much aside from the Haddock documentation
[1] [2] and some misc links on my webpage [3].

[1] 
http://hackage.haskell.org/packages/archive/atom/1.0.4/doc/html/Language-Atom-Language.html
[2] 
http://hackage.haskell.org/packages/archive/atom/1.0.4/doc/html/Language-Atom-Expressions.html
[3] http://tomahawkins.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Type families vs. functional dependencies -- how to express something

2010-05-24 Thread Ryan Ingram
I'm pretty sure this is a bug.  My code works if I put a type
signature on your second example.

*TFInjectivity> :t testX'
testX' :: (P a ~ B (L a), X' a) => a -> B (L a)

*TFInjectivity> :t testX' (\(A _) -> B __) :: B (HCons a HNil)
testX' (\(A _) -> B __) :: B (HCons a HNil) :: B (HCons a HNil)

*TFInjectivity> :t testX' (\(A _) -> B __)

Top level:
Couldn't match expected type `t TFInjectivity.:R1L B a'
   against inferred type `a'
  Expected type: B (L (A t -> B a))
  Inferred type: P (A t -> B a)

Here's my back-of-the-envelope thoughts on how typechecking should go:

*TFInjectivity> :t (\(A _) -> B __)
(\(A _) -> B __) :: A t -> B a

*TFInjectivity> :t testX'
testX' :: (P a ~ B (L a), X' a) => a -> B (L a)

testX' (\(A _) -> B__)

introduce variables for (\(A _) -> B__)
(\(A _) -> B __) :: A t1 -> B t2

introduce variables and desired context for testX'
testX' :: t3 -> B (L t3)

needed:
1)  P t3 ~ B (L t3),
2)   X' t3
have:
3)  t3 ~ (A t1 -> B t2)

apply (3) to (1) and (2)

needed:
4) P (A t1 -> B t2) ~ B (L (A t1 -> B t2))
5) X' (A t1 -> B t2)
apply X' instances to discharge (5)

apply P from X' instance (A t -> x) to (4)
6) P (B t2) ~ B (L (A t1 -> B t2))

apply P from X' instance (B t) to (6)
7) B t2 ~ B (L (A t1 -> B t2))

injectivity of data constructor
8) t2 ~ L (A t1 -> B t2)

(this is a very interesting unification to have to make, and might be
the heart of the problem?  it looks like an infinite type, but it's
not!)

apply L from X' instance (A t -> x) to (8)
9) t2 ~ HCons t1 (L (B t2))

apply L from X' instance (B t2) to (9)
10) t2 ~ HCons t1 HNil

unify t2 and HCons t1 HNil, discharge

testX' (\(A _) -> B __) :: B (L (A t1 -> B t2))
or, simplifying,
testX' (\(A _) -> B __) :: B (HCons t1 HNil)

(Code follows)

  -- ryan

{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
module TFInjectivity where

__ = undefined

data HNil = HNil
data HCons a b = HCons a b

data A a = A a
data B a = B a

class X' a where
type L a
type P a
ll' :: a -> L a
pp' :: a -> P a

instance X' (B l) where
type L (B l) = HNil
type P (B l) = B l
ll' _ = HNil
pp' p = p

instance (X' x) => X' (A t -> x) where
type L (A t -> x) = HCons t (L x)
type P (A t -> x) = P x
ll' _ = HCons __ (ll' (__ :: x))
pp' p = pp' (p (A (__ :: t)))

testX' :: (L a ~ l, P a ~ B l, X' a) => a -> B l
testX' x = pp' x




2010/5/18 Tomáš Janoušek :
> Hello all,
>
> for the past few hours I've been struggling to express a certain idea using
> type families and I really can't get it to typecheck. It all works fine using
> functional dependencies, but it could be more readable with TFs. From those
> papers about TFs I got this feeling that they should be as expressive as FDs,
> and we should use them (some people even occasionally mentioning that FDs may
> be deprecated in favor of them). Can someone help me make the following work,
> please?
>
> The working code with functional dependencies:
>
>> {-# LANGUAGE FlexibleInstances #-}
>> {-# LANGUAGE MultiParamTypeClasses #-}
>> {-# LANGUAGE FunctionalDependencies #-}
>> {-# LANGUAGE TypeFamilies #-}
>> {-# LANGUAGE UndecidableInstances #-}
>> {-# LANGUAGE ScopedTypeVariables #-}
>>
>> __ = undefined
>>
>> data HNil = HNil
>> data HCons a b = HCons a b
>>
>> data A a = A a
>> data B a = B a
>>
>> class X a l p | a -> l p where
>>     ll :: a -> l
>>     pp :: a -> p
>>
>> instance X (B l) HNil (B l) where
>>     ll _ = HNil
>>     pp p = p
>>
>> instance (X x l p) => X (A t -> x) (HCons t l) p where
>>     ll _ = HCons __ (ll (__ :: x))
>>     pp p = pp (p (A (__ :: t)))
>>
>> -- (inferred)
>> -- testX :: (X a l (B l)) => a -> B l
>> testX x = pp x `asTypeOf` B (ll x)
>
> The motivation here is that A a represents a variable of type a, B b
> represents a computation with state b, and functions of type A a -> B b
> represent a computations with state b that use the first parameter as an
> accessor for a variable (or, more precisely, state component) of type a. Now,
> I want testX to take such function (with n parameters) and provide it with
> those accessors, fixing the type b to contain components of the corresponding
> accessors only.
> (The example uses dummy types and undefineds for simplicity.)
>
> This pretty much works:
>
> testX (B __)                       :: B HNil
> testX (\(A _) -> B __)             :: B (HCons t HNil)
> testX (\(A True) -> B __)          :: B (HCons Bool HNil)
> testX (\(A _) (A _) -> B __)       :: B (HCons t (HCons t1 HNil))
> testX (\(A _) (A _) (A _) -> B __) :: B (HCons t (HCons t1 (HCons t2 HNil)))
> testX (\(A _) -> B HNil)           :: error
>
>
> This is my attempt to rephrase it using type families:
>
>> class X' a where
>>     type L a
>>     type P a
>>     ll' :: a -> L a
>>     pp' :: a -> P a
>>
>> instance X' (B l) where
>>     type L (B l) = HNil
>>     type P (B l) = B l
>>     ll' _ = HNil
>>     pp' p = p
>>
>> instance (X' x) => X' (

Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Daniel Fischer
On Tuesday 25 May 2010 04:26:07, Ivan Miljenovic wrote:
> On 25 May 2010 12:20, Magicloud Magiclouds
>
>  wrote:
> > This is the function. The problem sure seems like something was
> > preserved unexpected. But I cannot find out where is the problem.
> >
> > seperateOutput file =
> >  let content = lines file
> >      indexOfEachOutput_ = fst $ unzip $ filter (\(i, l) ->
> >                                                 " Log for "
> > `isPrefixOf` l ) $ zip [0..] content indexOfEachOutput =
> > indexOfEachOutput_ ++ [length content] in
>
>  
>
>  Expensive bit
>
> >  map (\(a, b) ->
> >         drop a $ take b content
> >      ) $ zip indexOfEachOutput $ tail indexOfEachOutput
>
> You're not "streaming" the String; you're also keeping it around to
> calculate the length (I'm also not sure how GHC optimises that if at
> all; it might even re-evaluate the length each time you use
> indexOfEachOutput.

Not that it helps, but it evaluates the length only once.
But it does that at the very end, when dealing with the last log.

>
> The zipping of indexOfEachOutput should be OK without that length at
> the end, as it will lazy construct the zipped list (only evaluating up
> to two values at a time).  However, you'd be better off using "zipWith
> f" rather than "map f . zip".

There'd still be the problem of

drop a $ take b content

, so nothing can be garbage collected before everything's done.

separateOutpout file =
let contents = lines file
split = break ("Log for " `isPrefixOf`)
msplit [] = Nothing
msplit lns = Just (split lns)
in drop 1 $ unfoldr msplit contents

should fix it.

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


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Ivan Miljenovic
On 25 May 2010 12:20, Magicloud Magiclouds
 wrote:
> This is the function. The problem sure seems like something was
> preserved unexpected. But I cannot find out where is the problem.
>
> seperateOutput file =
>  let content = lines file
>      indexOfEachOutput_ = fst $ unzip $ filter (\(i, l) ->
>                                                 " Log for " `isPrefixOf` l
>                                               ) $ zip [0..] content
>      indexOfEachOutput = indexOfEachOutput_ ++ [length content] in

 

 Expensive bit
>  map (\(a, b) ->
>         drop a $ take b content
>      ) $ zip indexOfEachOutput $ tail indexOfEachOutput

You're not "streaming" the String; you're also keeping it around to
calculate the length (I'm also not sure how GHC optimises that if at
all; it might even re-evaluate the length each time you use
indexOfEachOutput.

The zipping of indexOfEachOutput should be OK without that length at
the end, as it will lazy construct the zipped list (only evaluating up
to two values at a time).  However, you'd be better off using "zipWith
f" rather than "map f . zip".

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
This is the function. The problem sure seems like something was
preserved unexpected. But I cannot find out where is the problem.

seperateOutput file =
  let content = lines file
  indexOfEachOutput_ = fst $ unzip $ filter (\(i, l) ->
 " Log for " `isPrefixOf` l
   ) $ zip [0..] content
  indexOfEachOutput = indexOfEachOutput_ ++ [length content] in
  map (\(a, b) ->
 drop a $ take b content
  ) $ zip indexOfEachOutput $ tail indexOfEachOutput

On Tue, May 25, 2010 at 10:12 AM, Ivan Miljenovic
 wrote:
> On 25 May 2010 12:02, Magicloud Magiclouds
>  wrote:
>> U is for UTF8 module. And I will try the modules you mentioned.
>> Although I thought Haskell IO is lazy enough
>
> If you're only streaming data, it probably would be.  However, you
> seem to keep some of it in memory, which is what the problem is.  You
> might be able to fix this by doing "main = readFile filename >>= liftM
> separateOutput >>= mapM_ foo".  However, it depends on what
> separateOutput does.
>
> Also, consider using when (from Control.Monad) instead of your if statement.
>
> --
> Ivan Lazar Miljenovic
> ivan.miljeno...@gmail.com
> IvanMiljenovic.wordpress.com
>



-- 
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Ivan Miljenovic
On 25 May 2010 12:02, Magicloud Magiclouds
 wrote:
> U is for UTF8 module. And I will try the modules you mentioned.
> Although I thought Haskell IO is lazy enough

If you're only streaming data, it probably would be.  However, you
seem to keep some of it in memory, which is what the problem is.  You
might be able to fix this by doing "main = readFile filename >>= liftM
separateOutput >>= mapM_ foo".  However, it depends on what
separateOutput does.

Also, consider using when (from Control.Monad) instead of your if statement.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
U is for UTF8 module. And I will try the modules you mentioned.
Although I thought Haskell IO is lazy enough

On Tue, May 25, 2010 at 9:46 AM, Ivan Miljenovic
 wrote:
> On 25 May 2010 11:41, Magicloud Magiclouds
>  wrote:
>> Hi,
>>  I have a file including some operation logs, in the format of the
>> following. And I have some code to analyze it. Well, it ate all my
>> memories.
>> ---
>> log:
>>  Log for item A
>> ===
>> 09:10 read accountA
>> 09:20 read accountB
>>
>>  Log for item B
>> 
>> ---
>> code:
>>  file <- U.readFile filename
>
> Which module have you imported there with the `U'?
>
> For large text files, you probably want to use either lazy Bytestrings
> or lazy Text values.
>
> --
> Ivan Lazar Miljenovic
> ivan.miljeno...@gmail.com
> IvanMiljenovic.wordpress.com
>



-- 
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Ivan Miljenovic
On 25 May 2010 11:41, Magicloud Magiclouds
 wrote:
> Hi,
>  I have a file including some operation logs, in the format of the
> following. And I have some code to analyze it. Well, it ate all my
> memories.
> ---
> log:
>  Log for item A
> ===
> 09:10 read accountA
> 09:20 read accountB
>
>  Log for item B
> 
> ---
> code:
>  file <- U.readFile filename

Which module have you imported there with the `U'?

For large text files, you probably want to use either lazy Bytestrings
or lazy Text values.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How to deal with huge text file?

2010-05-24 Thread Magicloud Magiclouds
Hi,
  I have a file including some operation logs, in the format of the
following. And I have some code to analyze it. Well, it ate all my
memories.
---
log:
 Log for item A
===
09:10 read accountA
09:20 read accountB

 Log for item B

---
code:
  file <- U.readFile filename
  mapM_ (\text ->
  let ope = parseOPE text in
  if findMissingOperation ope
then U.putStrLn $ show $ fst ope
else return ()
) $ seperateOutput file --This function separates the input
text file into paragraph by "Log for".
-- 
竹密岂妨流水过
山高哪阻野云飞
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Good US Grad schools for functional languages?

2010-05-24 Thread Jason Dusek
2010/05/17 Tim Chevalier :
> The first three names on that list of faculty members are members of
> the HASP group (High Assurance Systems Programming), which is an
> active research group focused on developing a call-by-value Haskell
> variant for systems programming. More info at
> http://hasp.cs.pdx.edu/

  Does call-by-value mean actually strict?

  Looking over the page on execution order on Wikipedia, it
  seems that there are degrees of strictness. I'm curious about
  the choice that was made with HASP. They seem to have bottom,
  according to the report; yet I don't know how you'd have
  bottom without laziness of some kind.

--
Jason Dusek
Linux User #510144 | http://counter.li.org/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Exception: : changeWorkingDirectory: does not exist (No such file or directory)

2010-05-24 Thread Daniel Fischer
On Monday 24 May 2010 21:35:10, Anatoly Yakovenko wrote:
> :set -fglasgow-exts

Can't you be more discriminating and turn on only those extensions you 
regularly use?

> :set prompt "> "
>
> Thats all i have in my .ghci file

Shouldn't cause a cd.

Maybe

$ ghci -v4

would give a hint?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Exception: : changeWorkingDirectory: does not exist (No such file or directory)

2010-05-24 Thread Rogan Creswick
On Fri, May 21, 2010 at 11:50 AM, Anatoly Yakovenko
 wrote:
> anato...@anatolyy-linux ~ $ ghci
> GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
> Loading package ghc-prim ... linking ... done.
> Loading package integer-gmp ... linking ... done.
> Loading package base ... linking ... done.
> Loading package ffi-1.0 ... linking ... done.
>> 1/2
> 0.5
> *** Exception: : changeWorkingDirectory: does not exist (No such file
> or directory)

Can you check the current directory via shell commands from ghci (:!
pwd) , or perhaps :cd to another location that you know to exist?

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


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Peter Verswyvelen
Yeah. Funny that we're still writing games in C++, while mission
critical and hard real time systems are written in much nicer
languages :)

I made something similar to Lucid Synchrone for a game company I used
to work, but with the purpose of making reactive programming
accessible to computer artists. The integrated development environment
provided the typical boxes-and-links user interface, where the boxes
were signal functions. Signals itself were not exposed, like Yampa.
The system did type inference so artists never really had to deal with
types. Special nodes like feedback and delay where provided to allow
transferring values to the next frame. This actually was a great
success, digital artists could literally create little interactive
applications with it, without much  help from programmers. This
resulted in a Playstation 3 visual experience "Mesmerize"
(http://www.youtube.com/watch?v=rW7qGhBjwhY). This was before I knew
Haskell or functional programming, so it was hacked together in C# and
C++...

I still believe that the reason why computers artists could work with
this environment and were not able to learn imperative programming is
functional programming itself: the system had all the goodies of FP:
type inference, referential transparancy, etc... But is also provided
the possibility to edit literals while the simulation was running,
providing zero turnaround times, which was equally important for quick
adoption of the software.

So IMO Haskell and FRP systems have a huge potential for education of
a much broader audience than just computer scientists...





On Mon, May 24, 2010 at 6:13 PM, Limestraël  wrote:
> I assumed also that it was a field which was still under research, however,
> Lustre, again, is used "for critical control software in aircraft,
> helicopters, and nuclear power plants", according to wikipedia.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Exception: : changeWorkingDirectory: does not exist (No such file or directory)

2010-05-24 Thread Anatoly Yakovenko
:set -fglasgow-exts
:set prompt "> "

Thats all i have in my .ghci file

On Fri, May 21, 2010 at 12:14 PM, Daniel Fischer
 wrote:
> On Friday 21 May 2010 20:50:39, Anatoly Yakovenko wrote:
>> anyone else seeing this behavior?
>>
>> anato...@anatolyy-linux ~ $ ghci
>> GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
>> Loading package ghc-prim ... linking ... done.
>> Loading package integer-gmp ... linking ... done.
>> Loading package base ... linking ... done.
>> Loading package ffi-1.0 ... linking ... done.
>>
>> > 1/2
>>
>> 0.5
>> *** Exception: : changeWorkingDirectory: does not exist (No such file
>> or directory)
>>
>> > 1/2
>>
>> *** Exception: : changeWorkingDirectory: does not exist (No such file
>> or directory)
>
> Never seen that.
> Just to make sure, there's nothing in any of your .ghci files that might
> cause it?
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: [Haskell] ANNOUNCE: Introducing Sifflet, visual functional programming language

2010-05-24 Thread gdweber
Thanks for the compliment -- and reading assignment.  I was not aware
of Gem Cutter; it looks quite impressive!

These are the features I'm hoping to add to Sifflet;
if you'd like to urge any particular priorities,
please let me know:
-  additional data types, possibly including trees
   and user-defined algebraic datatypes
-  higher-order functions 
-  exporting code to Haskell and other languages

Greg


On 2010-May-15, Henning Thielemann wrote:
> Gregory D. Weber schrieb:
> > Introducing Sifflet -- version 0.1.5, first public release!
> > 
> > Sifflet is a visual, functional programming language. 
> 
> Cool - when do we get something like Gem Cutter? :-)
> http://resources.businessobjects.com/labs/cal/gemcutter-techpaper.pdf
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-- 
   ___   ___  __ _  
  / _ \ / _ \| || | Gregory D. Weber, Associate Professor
 / /_\// / | | | /\ | | Indiana University East
/ /_\\/ /__| | |/  \| | http://mypage.iu.edu/~gdweber/
\/\_/\___/\__/  Tel. (765) 973-8420; FAX (765) 973-8550
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Dimitry Golubovsky
Tillmann,

OK, I see: your code parses the "glyph" element which contains the
same kind of path definition that the "path" element does.

I think your code would be helpful for me as well.

And I think I'll use the same "xml" package to read in the SVG file (I
was thinking about this package earlier, and your code has a good
example of using it).

Thank you.

On Mon, May 24, 2010 at 12:20 PM, Tillmann Vogt
 wrote:
>
[skip]
> more fully. I have spent quite some time on a tricky function
> "commandsToPoints" in ReadFont.hs which is about parsing the d field and
> translating it into outline points. Are you looking for something like that?
>
>>
>> That is, the syntax of the "d" attribute (e. g. M 100 100 L 300 100 L
>> 200 300 z)?
>>
-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Tillmann Vogt

Am 24.05.2010 14:21, schrieb Dimitry Golubovsky:

Hi,

Does there exist any Haskell package/library to parse the syntax of
SVG elements, esp. PATH?


Hi Dimitry,

If you search on hackage for svg, you find my library SVGFonts. I first 
thought SVGFont is a special syntax similar to SVG, but it seems to be a 
subset of SVG. In my opinion it would be OK to split the SVG part out 
into a new library. I have made some improvements to SVGFonts which I 
haven't uploaded (i.e. points from bezier curves lying in a raster of a 
certain resolution). From a short look at Hennings code I guess my code 
may be little bit more beginner style, but parsing of the d attribute is 
implemeted more fully. I have spent quite some time on a tricky function 
"commandsToPoints" in ReadFont.hs which is about parsing the d field and 
translating it into outline points. Are you looking for something like that?




That is, the syntax of the "d" attribute (e. g. M 100 100 L 300 100 L
200 300 z)?

Hackage doesn't seem to have any, and Google search yields very broad results.

Thanks.

PS It should not be hard to write such parser, I just don't want to
reivent the wheel ;)



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


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Limestraël
> But you have to be aware that Elerea, Yampa, Lucid Synchrone and Lustre
> are all very similar in their foundations.

Okay. I just thought that reactive programming was a quite new field of
research, but I saw that Lustre and Esterel date back to 1980...
I assumed also that it was a field which was still under research, however,
Lustre, again, is used "for critical control software in aircraft,
helicopters, and nuclear power plants", according to wikipedia.

2010/5/24 Patai Gergely 

> > One problem with Elerea experimental branch besides the update time
> > control:
> > the memo function. I can't understand when I have to call it and when I
> > don't.
> Technically, you never have to. However, if you have a signal derived
> from others by pure application (i.e. fmap or <*>), keep in mind that
> its output will be recalculated as many times as you request it. The
> memo element can be used as a proxy to prevent that. E.g. if you have z
> = liftA2 f x y, and you request z n times, f will also be called n
> times. But if you have z <- memo (liftA2 f x y) instead, then the
> calculation will only happen once. If Elerea wasn't an EDSL, these memo
> elements could be inserted automatically, but now I have no means to
> tell how many times a certain signal is referred to, so the burden is on
> the programmer.
>
> The old version doesn't have this inconvenience, because it memoises all
> the applicative nodes too. Since most of them are only referred to once,
> this is adds a lot of unnecessary overhead.
>
> > Just to know, have you been told of a language dedicated to reactive
> > programming (even experimental)? I mean, not an embedded language just
> > like Yampa is.
> Those that Peter mentioned are good examples, and there is also Lustre.
> But you have to be aware that Elerea, Yampa, Lucid Synchrone and Lustre
> are all very similar in their foundations.
>
> Gergely
>
> --
> http://www.fastmail.fm - The professional email service
>
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Henning Thielemann


On Mon, 24 May 2010, Dimitry Golubovsky wrote:


Henning,

Thanks, I'll try to use your code.

BTW does it handle the syntax where repeated operation is omitted, per
SVG spec 8.3.1?


Don't know, I just wrote the little parser in a way that it could handle 
my example SVG file. :-)

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


Re: [Haskell-cafe] problem with regex replace with back references

2010-05-24 Thread Daniel Fischer
On Monday 24 May 2010 17:08:50, Juan Maiz wrote:
> I'm trying use subRegex to replace using back references just like the
> docs says:
> http://hackage.haskell.org/packages/archive/regex-compat/0.92/doc/html/T
>ext-Regex.html#v%3AsubRegex
>
> But when i try to replace with \1 i got \SOH and not "e". Can anyone
> help?
>
> subRegex (mkRegex "e") "hello" "\1"
> => "h\SOHllo"

Try

subRegex (mkRegex "e") "hello" "\\1"

>
> Thanks in advance

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


[Haskell-cafe] A most inelegant approach to "extensible records"

2010-05-24 Thread Günther Schmidt

Hi everyone,

as I'm trying to design a "query language" the one thing that causes the 
most grieve is the apparent requirement for "extensible records".


There are by now a number of solutions in Haskell for this, most 
prominently HList.
But at the end of the day even for HList to work one needs to define 
singleton types, something like:


data FirstName = FirstName
data LastName = LastName
data BirthDate = BirthDate

Now this isn't much of a nit and at least it works.

But overall review of "extensible records" indicates that any 
solution/implementation requires a tremendous amount of type-level trickery.
I short, any approach I've seen so far uses elaborate type class 
hierarchies, functional dependencies, etc., all coding on the *type* level.


I have here a very, very inelegant alternative, of which I wonder if it 
offers a new angle to pursue the whole thing.


1. Initial "Record"

names = \fn -> fn "firstName" "lastName" "birthDate" "zipCode"

Please ignore for now that all "fields" are of type String.


2. "Extension" of Record

namesCity = \fn -> names fn "residence"

The record (1.) gets "extended" by the field "residence"


3. Selection

nameZip n _ _ _ z = \fn -> fn n z

basically here we "extract" the fields firstName and residence.


4. Test

toList a b = [a, b]

test = (namesCity nameZip) toList


Now I know this is all very very inelegant and at 1st sight totally 
unfeasible. But maybe we can use Conal Eliots semantic editor 
combinators to smoothen this out?


Günther


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


[Haskell-cafe] problem with regex replace with back references

2010-05-24 Thread Juan Maiz
I'm trying use subRegex to replace using back references just like the docs
says:
http://hackage.haskell.org/packages/archive/regex-compat/0.92/doc/html/Text-Regex.html#v%3AsubRegex

But when i try to replace with \1 i got \SOH and not "e". Can anyone help?

subRegex (mkRegex "e") "hello" "\1"
=> "h\SOHllo"

Thanks in advance


-- 
Juan Maiz Lulkin Flores da Cunha
-
=== @ Softa
=== http://mailee.me
=== http://hi.im/joaomilho
-
“The most exciting breakthroughs of the 21st century will not occur because
of technology but because of an expanding concept of what it means to be
human” John Naisbitt
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Dimitry Golubovsky
Henning,

Thanks, I'll try to use your code.

BTW does it handle the syntax where repeated operation is omitted, per
SVG spec 8.3.1?

--
The command letter can be eliminated on subsequent commands if the
same command is used multiple times in a row (e.g., you can drop the
second "L" in "M 100 200 L 200 100 L -100 -200" and use "M 100 200 L
200 100 -100 -200" instead).
--

see http://www.w3.org/TR/SVG11/paths.html#PathDataGeneralInformation

On Mon, May 24, 2010 at 10:43 AM, Henning Thielemann
 wrote:
>
[skip]
> Once I wrote such a function in order to convert an SVG path to PDF. See
> parsePath in
>  http://code.haskell.org/~thielema/internetmarke/src/Main.hs
>



-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Henning Thielemann


On Mon, 24 May 2010, Dimitry Golubovsky wrote:


Does there exist any Haskell package/library to parse the syntax of
SVG elements, esp. PATH?

That is, the syntax of the "d" attribute (e. g. M 100 100 L 300 100 L
200 300 z)?

Hackage doesn't seem to have any, and Google search yields very broad results.


Once I wrote such a function in order to convert an SVG path to PDF. See 
parsePath in

  http://code.haskell.org/~thielema/internetmarke/src/Main.hs
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell, Queries and Monad Comprehension

2010-05-24 Thread C. McCann
2010/5/23 Günther Schmidt :
> is there anybody currently using Haskell to construct or implement a query
> language?

I've a half-baked, type-indexed (in HList style) implementation of
relational algebra lying around somewhere, if that counts as a "query
language". I was experimenting with using it as a sort of abstract
collection interface, which actually worked rather nicely I think, but
I didn't have time to flesh it out completely. In particular, only
very simple queries and limited kinds of relation composition were
supported. Definitely just toy code, though, and dreadfully
inefficient; if you're looking for an "actual implementation" meaning
"usable interface to an external persistence layer" then disregard
this.

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


Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Daniel Fischer
On Monday 24 May 2010 15:48:14, Jonas Almström Duregård wrote:
> >Consider that calling
> >
> >> id undefined
> >
> >requires evaluating undefined before you can call id.  The program will
> > "crash" before you ever call id.  Of >course, the identity function
> > "should" have produced a value that crashed in exactly the same way. 
> > But we >never got there.
>
> In which sense does id need to evaluate its argument?

It doesn't need to, and it doesn't. It just returns its argument untouched.

> If evaluating
> the statement "id undefined" in ghci, then the print function (and
> ultimately the show function) evaluates the undefined. I suppose that
> if the show function does not evaluate its argument then there will be
> no error, right?

Right:

Prelude Text.Show.Functions> id undefined :: (Bool -> Bool)


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


[Haskell-cafe] Calculating a value as side effect of converting list of strings into list of records.

2010-05-24 Thread Eugeny N Dzhurinsky
Hello, All!

I need some help to solve the following task:

=
import Data.Map as M 
import Data.List as L

data Pair = Pair { name, value :: String }

type IxPair = (Int, String, String)

type IxPairParser = Pair -> Maybe IxPair

type RecordUpdateF r = String -> String -> r -> r

convertPairsToRecords :: RecordUpdateF r -> IxPairParser -> r -> [Pair] -> [r]
convertPairsToRecords updateRecF parsePairF initRec pairs = M.elems $ L.foldl' 
processWithPairs initMap pairs
where
initMap = M.empty
processWithPairs resMap = maybe resMap (updateMapF resMap) . parsePairF
updateMapF res (idx, key, value) | idx `M.member` res = M.adjust 
(updateRecF key value) idx res
 | otherwise = M.insert idx (updateRecF 
key value initRec) res
=

In short, input looks like name=value pairs:
pair_1_username=user
pair_1_password=pass
pair_1_fullname=vasya poopking

The parser IxPairParser takes the pair of name=value, and extracts ordering
number of the current pair, making it a triple like below

(1, username, user)

then convertPairsToRecords takes the triple and performs lookup in the Map
for a record with given ID. Then it updates the record and places it back into
the map. If no record is found - then new one is created, updated and inserted
into the Map.

Now, I've got the case when input contains pairs like below

pair_1_lastlogin=2010-05-24 12:23
...
pair_2_lastlogin=2009-12-20 10:30
...
pair_2_lastlogin=2010-04-06 18:20

At this point I need to update the record and keep the latest date somewhere,
so it will be possible to extract the latest login date among all such pairs.

I can think about post-processing list [r], extract lastlogin field and simply
use fold to get the oldest one. But I'd like to calculate this information
during parsing of the input. And I am not allowed to change the interface of
convertPairsToRecords.

Can somebody please suggest how to solve the task? Probably with Writer monad,
or may be State?

Thank you in advance!

-- 
Eugene Dzhurinsky


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


[Haskell-cafe] Haskell SVG path parser?

2010-05-24 Thread Dimitry Golubovsky
Hi,

Does there exist any Haskell package/library to parse the syntax of
SVG elements, esp. PATH?

That is, the syntax of the "d" attribute (e. g. M 100 100 L 300 100 L
200 300 z)?

Hackage doesn't seem to have any, and Google search yields very broad results.

Thanks.

PS It should not be hard to write such parser, I just don't want to
reivent the wheel ;)

-- 
Dimitry Golubovsky

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


Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Jonas Almström Duregård
>Consider that calling
>
>> id undefined
>
>requires evaluating undefined before you can call id.  The program will 
>"crash" before you ever call id.  Of >course, the identity function "should" 
>have produced a value that crashed in exactly the same way.  But we >never got 
>there.

In which sense does id need to evaluate its argument? If evaluating
the statement "id undefined" in ghci, then the print function (and
ultimately the show function) evaluates the undefined. I suppose that
if the show function does not evaluate its argument then there will be
no error, right?

/Jonas

On 24 May 2010 09:05, Alexander Solla  wrote:
>
> On May 23, 2010, at 2:53 AM, Lennart Augustsson wrote:
>
>> BTW, the id function works fine on bottom, both from a semantic and
>> implementation point of view.
>
> Yes, but only because it doesn't work at all.  Consider that calling
>
>> id undefined
>
> requires evaluating undefined before you can call id.  The program will
> "crash" before you ever call id.  Of course, the identity function "should"
> have produced a value that crashed in exactly the same way.  But we never
> got there.
>
> It works in same way (==) works on bottoms.  Vacuously.  Indeed, functions
> only work on values.  There is no value of type (forall a . a).  Ergo, id
> does not work on undefined, as a function applying to a value.  It is happy
> coincidence that the behavior of the runtime can be made mostly compatible
> with our familiar semantics.  But not entirely.
>
> Consider:
>
> *Main> let super_undefined = super_undefined
> *Main> undefined == super_undefined
> *** Exception: Prelude.undefined
> *Main> super_undefined == super_undefined
> (wait forever)
> *Main> id super_undefined
> (wait forever)
> *Main> id undefined
> *** Exception: Prelude.undefined
>
> From a mathematical perspective, super_undefined is Prelude.undefined.  But
> it takes some runtime level hackery to make undefined an exceptional
> "value".  Without it, super_undefined loops, despite the fact that their
> definitions are exactly the same  (The "value" defined by itself).
>
> I did not suggest those are the wrong semantics.  Only that the study of
> their semantics doesn't belong to the study of Haskell as a logic/language.
> ___
> 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] Best way to instance Fix?

2010-05-24 Thread Sam Martin

That's great, thanks. Looks like FlexibleContexts is redundant (effectively a 
subset of UndecidableInstances?).

Ivan, I hadn't realised, but I had FlexibleInstances on before for other 
reasons. I guess that's why I ccould get the workaround to compile. 

Cheers,
Sam

-Original Message-
From: Reid Barton [mailto:rwbar...@math.harvard.edu]
Sent: Mon 24/05/2010 02:28
To: Sam Martin
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Best way to instance Fix?
 
On Mon, May 24, 2010 at 02:13:32AM +0100, Sam Martin wrote:
> 
> Hi!
> 
> I'm trying to work out the best way to generate (ideally derive) instances 
> for the Fix type. Here's a cut down example:
> 
> data Greet x = AlloAllo x x | AuRevoir deriving Show
> newtype Fix f = In { out :: f (Fix f) } -- deriving Show -- DOESN'T COMPILE
> 
> -- workaround
> instance Show (Fix Greet) where show (In i) = "In " ++ show i
> 
> In other words, given a number of parametised types that I can derive, say, 
> Ord, Eq and Show for, how should I go about getting the instances for the 
> Fix-d version of them as well? I've tried a few things, but no luck so far. 
> 
> Any clues?

You can use GHC's standalone deriving mechanism for this, described at
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/deriving.html


{-# LANGUAGE StandaloneDeriving, FlexibleContexts, UndecidableInstances #-}

data Greet x = AlloAllo x x | AuRevoir deriving Show
newtype Fix f = In { out :: f (Fix f) }

deriving instance Show (f (Fix f)) => Show (Fix f)


Regards,
Reid Barton

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


[Haskell-cafe] ANNOUNCE: yesod 0.2.0

2010-05-24 Thread Michael Snoyman
Hi all,

I'm very happy to announce the release of yesod 0.2.0. Yesod is a Haskell
web framework for type-safe, RESTful web applications.

I won't bore you all with the full release announcement here, please see the
blog[1]. Installing yesod should be as simple as: cabal update && cabal
install yesod. Please note that due to usage of type families in Template
Haskell code, this release requires GHC 6.12.

To get started with Yesod, I recommend going through the tutorials on the
documentation site[2]. Please let me know if anything is unclear, or if you
find any bugs.

The next feature I'm targeting for Yesod is persistence. If anyone has any
thoughts to share on this topic, please send me an e-mail.

Michael

[1] http://www.snoyman.com/blog/entry/yesod-0-2-0-released/
[2] http://docs.yesodweb.com/yesod/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Functional Parsers in GHCI

2010-05-24 Thread Stephen Tetley
Hi - it looks like I pointed you to the wrong file:

You want to download both these two and put them in the same directory -

http://www.cs.nott.ac.uk/~gmh/Parsing.lhs
http://www.cs.nott.ac.uk/~gmh/parser.lhs

Parsing.lhs is the library, parser.lhs is the example module that has
an expression parser.

Sorry for the confusion.

Best wishes

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


Re: [Haskell-cafe] Functional Parsers in GHCI

2010-05-24 Thread Amiruddin Nagri
I am getting following error while trying to load
http://www.cs.nott.ac.uk/~gmh/parser.lhs

Prelude> :l parsers2.hs

parsers2.hs:1:7:
Could not find module `Parsing':
  Use -v to see a list of the files searched for.
Failed, modules loaded: none.

Am I missing something again ?

Thanks for help,
Amiruddin Nagri,
Bangalore, 560008, KA
India

Y! IM : amir_na...@yahoo.com
GTalk : amir.na...@gmail.com



On Sun, May 23, 2010 at 1:11 PM, Stephen Tetley wrote:

> Hi
>
> The code in this chapter isn't actually Haskell - some details are
> elided to make the presentation clearer. To run the code you want to
> get the file mentioned in the closing remarks of the chapter (page 85,
> section 8.9).
>
>
> http://www.cs.nott.ac.uk/~gmh/book.html
>
> http://www.cs.nott.ac.uk/~gmh/parser.lhs
>
> Best wishes
>
> Stephen
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Patai Gergely
> One problem with Elerea experimental branch besides the update time
> control:
> the memo function. I can't understand when I have to call it and when I
> don't.
Technically, you never have to. However, if you have a signal derived
from others by pure application (i.e. fmap or <*>), keep in mind that
its output will be recalculated as many times as you request it. The
memo element can be used as a proxy to prevent that. E.g. if you have z
= liftA2 f x y, and you request z n times, f will also be called n
times. But if you have z <- memo (liftA2 f x y) instead, then the
calculation will only happen once. If Elerea wasn't an EDSL, these memo
elements could be inserted automatically, but now I have no means to
tell how many times a certain signal is referred to, so the burden is on
the programmer.

The old version doesn't have this inconvenience, because it memoises all
the applicative nodes too. Since most of them are only referred to once,
this is adds a lot of unnecessary overhead.

> Just to know, have you been told of a language dedicated to reactive
> programming (even experimental)? I mean, not an embedded language just
> like Yampa is.
Those that Peter mentioned are good examples, and there is also Lustre.
But you have to be aware that Elerea, Yampa, Lucid Synchrone and Lustre
are all very similar in their foundations.

Gergely

-- 
http://www.fastmail.fm - The professional email service

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


Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Lennart Augustsson
That's totally false.  You don't evaluate 'undefined' before calling 'id'.
(Or if you, it's because you've made a transformation that is valid
because 'id' is strict.)


On Mon, May 24, 2010 at 9:05 AM, Alexander Solla  wrote:
> Yes, but only because it doesn't work at all.  Consider that calling
>
>> id undefined
>
> requires evaluating undefined before you can call id.  The program will
> "crash" before you ever call id.  Of course, the identity function "should"
> have produced a value that crashed in exactly the same way.  But we never
> got there.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Peter Verswyvelen
> Just to know, have you been told of a language dedicated to reactive
> programming (even experimental)? I mean, not an embedded language just like
> Yampa is.

Maybe Lucid Synchrone (http://www.lri.fr/~pouzet/lucid-synchrone/) and
Timber (http://www.timber-lang.org)?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Peter Verswyvelen
> 2010/5/24 Patai Gergely 
>>
>> > IMO: For AAA game programming? Definitely not. For exploring new ways
>> > of doing game programming and having a lot of fun and frustration?
>> > Sure! For making casual games? I don't know.
>> Why not casual games? I don't see any immediate difficulty. Do you have
>> any particular bad experience?

Well, I guess it is possible for casual games. Without FRP Monadius
runs fine (http://www.youtube.com/watch?v=zqFgQiPKtOI), so Haskell
itself seems to be realtime enough for handling the job (with .NET it
used to be a problem when the garbage collector started doing a
generation 2 collection; the game would stall, might be fixed in .NET
4, not sure how realtime the Haskell garbage collector is in the long
run). FRAG (which uses Yampa)
(http://www.youtube.com/watch?v=0jYdu2u8gAU&feature=related) also
indicates it can be done. So my "I don't know" should have been a "I
think it is" :-)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell, Queries and Monad Comprehension

2010-05-24 Thread Felipe Lessa
On Mon, May 24, 2010 at 03:20:41AM +0200, Günther Schmidt wrote:
> Hi all,
>
> is there anybody currently using Haskell to construct or implement a
> query language?

Do you mean, HaskellDB?

Cheers,

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


Re: [Haskell-cafe] [ANNOUNCE] First Public Release of the Snap Framework

2010-05-24 Thread Christopher Done
Agreed, I think Snap just raised the bar for presentation of Haskell
libraries. It even has a custom Haddock style sheet! I'm glad it is
built up of separate packages. I also look forward to using it.

On 22 May 2010 09:10, Chris Eidhof  wrote:
> Awesome! Congratulations on the first release, I look forward to working with 
> it. Also, the web design is great, possibly the best designed Haskell library 
> website I've seen so far.
>
> -chris
>
> On 22 mei 2010, at 07:25, Gregory Collins wrote:
>
>> Hello all,
>>
>> To coincide with Hac Phi 2010
>> (http://www.haskell.org/haskellwiki/Hac_%CF%86), the Snap team is happy
>> to announce the first public release of the Snap Framework, a simple and
>> fast Haskell web programming server and library for unix systems. For
>> installation instructions, documentation, and more information, see our
>> website at http://snapframework.com/.
>>
>> Snap is well-documented and has a test suite with a high level of code
>> coverage, but it is early-stage software with still-evolving interfaces. Snap
>> is therefore most likely to be of interest to early adopters and potential
>> contributors.
>>
>> Snap is BSD-licensed and currently only runs on Unix platforms; it has been
>> developed and tested on Linux and Mac OSX Snow Leopard.
>>
>> Snap Features:
>>
>> * A simple and clean monad for web programming, similar to happstack's but
>>   simpler.
>>
>> * A *fast* HTTP server library with an optional high-concurrency backend
>>   (using libev).
>>
>> * An XML-based templating system for generating xhtml that allows you to bind
>>   Haskell functionality to XML tags in your templates.
>>
>> * Some useful utilities for web handlers, including gzip compression and
>>   fileServe.
>>
>> * Iteratee-based I/O, allowing composable streaming in O(1) space without any
>>   of the unpredictable consequences of lazy I/O.
>>
>> If you have questions or comments, please contact us on our mailing list
>> (http://mailman-mail5.webfaction.com/listinfo/snap) or in the
>> #snapframework channel on the freenode IRC network.
>>
>> Cheers,
>> G
>> --
>> Gregory Collins 
>> ___
>> 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] [reactive] A pong and integrate

2010-05-24 Thread Limestraël
One problem with Elerea experimental branch besides the update time control:
the memo function. I can't understand when I have to call it and when I
don't.

Just to know, have you been told of a language dedicated to reactive
programming (even experimental)? I mean, not an embedded language just like
Yampa is.

2010/5/24 Patai Gergely 

> > IMO: For AAA game programming? Definitely not. For exploring new ways
> > of doing game programming and having a lot of fun and frustration?
> > Sure! For making casual games? I don't know.
> Why not casual games? I don't see any immediate difficulty. Do you have
> any particular bad experience?
>
> Limestraël:
>
> > I find Elerea fine so far, but it is still experimental and more limited
> > than Yampa.
> Well, it's more expressive in one way and more limited in another.
> Elerea lifts some limitations of Yampa by extending it with the
> ArrowApply/Monad interface, and you can certainly reimplement all the
> crazy switching combinators using the basic building blocks provided by
> the library. However, you cannot stop a signal in Elerea, while that's
> trivial in Yampa. I believe Elerea needs two more basic combinators: a
> simple 'untilB'-like switcher (mainly to be able to tell when a signal
> ends) and a freezing modifier that allows you to control the updates of
> a signal (or more like a whole subnetwork). The semantics of the latter
> is not clear to me yet (I don't intend to introduce a full-fledged clock
> calculus à la Lucid Synchrone if it's possible to avoid), and I
> want to work it out properly before implementing anything.
>
> Gergely
>
> --
> http://www.fastmail.fm - Choose from over 50 domains or use your own
>
> ___
> 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: Proof question -- (==) over Bool

2010-05-24 Thread Jon Fairbairn
Alexander Solla  writes:

> On May 23, 2010, at 1:35 AM, Jon Fairbairn wrote:
>
>> It seems to me relevant here, because one of the uses to which
>> one might put the symmetry rule is to replace an expression “e1
>> == e2” with “e2 == e1”, which can turn a programme that
>> terminates into a programme that does not.
>
> I don't see how that can be (but if you have a counter
> example, please show us). 

Oops! I was thinking of the symmetry rule in general. What I
said applies to “a && b” and not to “a == b”, but my point was
that surely you can’t be sure of that until after you’ve
finished a proof that does consider ⊥?

-- 
Jón Fairbairn jon.fairba...@cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2009-01-31)

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


Re: [Haskell-cafe] [reactive] A pong and integrate

2010-05-24 Thread Patai Gergely
> IMO: For AAA game programming? Definitely not. For exploring new ways
> of doing game programming and having a lot of fun and frustration?
> Sure! For making casual games? I don't know.
Why not casual games? I don't see any immediate difficulty. Do you have
any particular bad experience?

Limestraël:

> I find Elerea fine so far, but it is still experimental and more limited
> than Yampa.
Well, it's more expressive in one way and more limited in another.
Elerea lifts some limitations of Yampa by extending it with the
ArrowApply/Monad interface, and you can certainly reimplement all the
crazy switching combinators using the basic building blocks provided by
the library. However, you cannot stop a signal in Elerea, while that's
trivial in Yampa. I believe Elerea needs two more basic combinators: a
simple 'untilB'-like switcher (mainly to be able to tell when a signal
ends) and a freezing modifier that allows you to control the updates of
a signal (or more like a whole subnetwork). The semantics of the latter
is not clear to me yet (I don't intend to introduce a full-fledged clock
calculus à la Lucid Synchrone if it's possible to avoid), and I
want to work it out properly before implementing anything.

Gergely

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own

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


Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-24 Thread Alexander Solla


On May 23, 2010, at 2:53 AM, Lennart Augustsson wrote:


BTW, the id function works fine on bottom, both from a semantic and
implementation point of view.


Yes, but only because it doesn't work at all.  Consider that calling

> id undefined

requires evaluating undefined before you can call id.  The program  
will "crash" before you ever call id.  Of course, the identity  
function "should" have produced a value that crashed in exactly the  
same way.  But we never got there.


It works in same way (==) works on bottoms.  Vacuously.  Indeed,  
functions only work on values.  There is no value of type (forall a .  
a).  Ergo, id does not work on undefined, as a function applying to a  
value.  It is happy coincidence that the behavior of the runtime can  
be made mostly compatible with our familiar semantics.  But not  
entirely.


Consider:

*Main> let super_undefined = super_undefined
*Main> undefined == super_undefined
*** Exception: Prelude.undefined
*Main> super_undefined == super_undefined
(wait forever)
*Main> id super_undefined
(wait forever)
*Main> id undefined
*** Exception: Prelude.undefined

From a mathematical perspective, super_undefined is  
Prelude.undefined.  But it takes some runtime level hackery to make  
undefined an exceptional "value".  Without it, super_undefined loops,  
despite the fact that their definitions are exactly the same  (The  
"value" defined by itself).


I did not suggest those are the wrong semantics.  Only that the study  
of their semantics doesn't belong to the study of Haskell as a logic/ 
language.

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