[Haskell-cafe] (no subject)
Hi all, Haskell, is arguably the best example of a design-by-committee language. The syntax is clean and most importantly, consistent. The essence of a purely functional programming is maintained, without disturbing its real world capacity. To all the people who revise the Haskell standard, and implement the language, 1. Promise to me, and the rest of the community, that you will keep up the good effort :) 2. Promise to me, and the rest of the community, that Haskell will always spiritually remain the same clean, consistent programming language as it is now! Regards, Zed Becker ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Mon, Jun 10, 2013 at 05:41:05PM +0530, Zed Becker wrote: Haskell, is arguably the best example of a design-by-committee language. You do realize that design-by-committee is generally understood to refer to the antipattern where a committee discusses a design to death and delivers an inconsistent, mediocre spec, as opposed to a situation where a leader figure takes the loose ends, runs with them, and turns them into a coherent, inspiring whole? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Mon, Jun 10, 2013 at 05:41:05PM +0530, Zed Becker wrote: Haskell, is arguably the best example of a design-by-committee language. The syntax is clean and most importantly, consistent. The essence of a purely functional programming is maintained, without disturbing its real world capacity. To all the people who revise the Haskell standard, and implement the language, 1. Promise to me, and the rest of the community, that you will keep up the good effort :) 2. Promise to me, and the rest of the community, that Haskell will always spiritually remain the same clean, consistent programming language as it is now! Hear hear! Hopefully we, the Haskell community, will be able to support this endevour with our time and efforts. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Zed, while I don't disagree regarding the clean and consistent syntax of Haskell, do you realize that some people would argue that camels are horses designed by committee too? :) While designing by committee guarantees agreement across a large number of people, it does not always ensure efficiency, as committees may lead to poor compromises, sometimes. However, Haskell may be an example of a good case of design-by-committee computer language. Flavio Flavio Villanustre On Mon, Jun 10, 2013 at 8:11 AM, Zed Becker zed.bec...@gmail.com wrote: Hi all, Haskell, is arguably the best example of a design-by-committee language. The syntax is clean and most importantly, consistent. The essence of a purely functional programming is maintained, without disturbing its real world capacity. To all the people who revise the Haskell standard, and implement the language, 1. Promise to me, and the rest of the community, that you will keep up the good effort :) 2. Promise to me, and the rest of the community, that Haskell will always spiritually remain the same clean, consistent programming language as it is now! Regards, Zed Becker ___ 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] (no subject)
Hm... Haskell was /developed/ by teams, but we had BEFORE: hope, miranda, ML ... The heritage is quite important. And individuals (say, Mark Jones) contributed to Haskell constructs. So, the /design/ is not entirely committe based 1. Promise to me, and the rest of the community, that Haskell will always spiritually remain the same clean, consistent programming language as it is now! Yes. Dear Mom, dear Dad! Promise me that you will never die... I wish that for all of you. Jerzy Karczmarczuk ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
It really sounds rude, to demand promises from somebody who just gave you a big present. Отправлено с iPhone 10.06.2013, в 16:11, Zed Becker zed.bec...@gmail.com написал(а): Hi all, Haskell, is arguably the best example of a design-by-committee language. The syntax is clean and most importantly, consistent. The essence of a purely functional programming is maintained, without disturbing its real world capacity. To all the people who revise the Haskell standard, and implement the language, Promise to me, and the rest of the community, that you will keep up the good effort :) Promise to me, and the rest of the community, that Haskell will always spiritually remain the same clean, consistent programming language as it is now! Regards, Zed Becker ___ 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] (no subject)
On Mon, Jun 10, 2013 at 05:44:26PM +0400, MigMit wrote: It really sounds rude, to demand promises from somebody who just gave you a big present. Without wishing to preempt Zed Becker, I interpreted his email as an expression of delight at how well Haskell has been designed and of hope that it may endure, rather than literally as a demand for the Haskell committee to grant him promises. I hope I haven't misunderstood. Tom ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
I have ever wondered how a committee could have made Haskell. My conclusion is the following: For one side there were many mathematicians involved, the authors of the most terse language(s) existent: the math notation. For the other, the lemma avoid success at all costs which kept the committee away of pressures for doing it quick and dirty and also freed it from deleterious individualities 2013/6/10 Tobias Dammers tdamm...@gmail.com On Mon, Jun 10, 2013 at 05:41:05PM +0530, Zed Becker wrote: Haskell, is arguably the best example of a design-by-committee language. You do realize that design-by-committee is generally understood to refer to the antipattern where a committee discusses a design to death and delivers an inconsistent, mediocre spec, as opposed to a situation where a leader figure takes the loose ends, runs with them, and turns them into a coherent, inspiring whole? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Alberto. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On 11/06/2013, at 1:58 AM, Alberto G. Corona wrote: I have ever wondered how a committee could have made Haskell. A committee made Algol 60, described as an improvement on most of its successors. A committee maintains Scheme. On the other hand, an individual gave us Perl. And an individual gave us JavaScript. And let's face it, an individual gave C++ its big start. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi Ertugrul, Thank you for the detailed reply. From what you wrote, partial FFI still seems like the way to go. Unfortunately Ogre isn't the only large library I'm using, so difficult several times over sounds like a good way to handicap the project early on. I'm perfectly happy to use Haskell for the strengths that will most benefit my project. I can always go back and try to bring the C++ specific parts into the fold once a prototype is up and running. As it seems there is a great deal of c/c++ to do either way, I would really appreciate so thoughts towards my original question. What practices in C++ are preferred by Haskell users, in the know, for the parts of the app that will not be pure Haskell? Should I be looking to avoid OOP? Dependency Injection? I wont reiterate all the facets of the first post, but it would help me immensely to zero in on a few patterns and strategies that can minimized the damage I inflict in c++ land. Thanks, Casey p.s. With That used to be true, but the reason has nothing to do with the language. The problem was that the libraries weren't there. What do you mean? Which packages should I be looking at? I am on iOS like I said, its a stage 1 GHC compiler so I don't have access to GHCI or template haskell. Casey Basichis caseybasichis at gmail.com wrote: I'm not entirely sure what you mean. I'm intending on using Ogre for GUI - for which there is the Hogre bindings, but after emailing the DEV about it, I didn't get the impression from his advice that I should be using it for production code. Here is what he suggested: It depends, really. Hogre is good for running Ogre from within Haskell, but it has its limitations. The number one thing people have been struggling with is handling input with hogre - there's Hois (Haskell wrapper for OIS) but it's not perfect (it misses input events), and the other option is having to write some C++ glue. Hogre is a solid proof of concept and you can do some demos with it, but if you're e.g. writing a game it might be a bit of a struggle. In the end it's about how much you value being able to write code in Haskell (or how allergic to C++ you are). I'm on iOS so I imagine those difficulties are compounded. I am using several other C++ libraries for which there are no existing bindings and no Haskell alternative packages that are even remotely close. Are you suggesting it would be better to write all my own FFI bindings for all the needed libraries? That's not what I'm suggesting. It was just too little information to properly judge the difficulty of doing everything in Haskell. Binding to Ogre (or C++ in general) is indeed difficult. If Hogre doesn't work or is too limited, your best option might be to write a C wrapper around the Hogre functionality you need. Another option is to use SDL/OpenGL directly, which may be easier or harder depending on your application. However, if you can build the bridge between your rendering library and Haskell, then Haskell is certainly the better choice. Everything I read suggests that Haskells strengths are in transformation and that interaction is not its strong suit. I am interested in your thoughts and I am open to whatever, but you are the first to suggest that the mix is a bad idea. That used to be true, but the reason has nothing to do with the language. The problem was that the libraries weren't there. Nowadays you can write all sorts of interactive applications in Haskell, including GUIs, TUIs, games, simulations and web applications. However, I've long been waiting for useful bindings to Ogre or Irrlicht, but I'm afraid that it's not going to happen any time soon. Ultimately it's your choice. Let me summarize the possiblities: * C wrapper around Ogre. Easy integration, but need to write the rendering code in C/C++. * Full FFI bindings to Ogre. Difficult integration, but you can write your rendering code in Haskell. * Partial FFI bindings to Ogre. Integration may be somewhat easy, if you do the initialization in Haskell and the actual rendering in C/C++. However, this again requires to write the rendering in C/C++. * Using SDL/OpenGL directly: Everything available for Haskell. May be difficult, because you need to write OpenGL code. I hope, this helps. Greets, Ertugrul ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
buildPair = do arr - newArray ((1,1),(1,10)) 37 :: ST s (STArray s (Int,Int) Int) a - readArray arr (1,1) writeArray arr (1,1) 64 b - readArray arr (1,1) return (a,b) main = print $ runST buildPair -- -- Regards, KC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
a href=http://dreadscottart.com/mynewwebsite/wp-content/plugins/extended-comment-options/02efpk.html; http://dreadscottart.com/mynewwebsite/wp-content/plugins/extended-comment-options/02efpk.html/a___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hello, I'm trying to figure out how to handle versioning of my IntervalMap package. I've just read the package versioning policy: http://www.haskell.org/haskellwiki/Package_versioning_policy I don't quite understand all the recommendations in the above document, though: a) You are not allowed to remove or change the types of existing stuff. Ok. b) You are allowed to add new functions. But that can break compilation because of name conflicts. Seems to be allowed on the grounds that this is easy to fix in the client code. c) You are not allowed to add new instances. I don't get this - how is this any worse than b)? I do understand that it is not generally possible to prevent breaking code - for example if the client code depends on buggy behavior that gets fixed in a minor version update. That seems unavoidable - after all, bugfixes are _the_ reason for minor updates. Regards, Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Thu, Jan 5, 2012 at 10:54 AM, Christoph Breitkopf chbreitk...@googlemail.com wrote: Hello, I'm trying to figure out how to handle versioning of my IntervalMap package. I've just read the package versioning policy: http://www.haskell.org/haskellwiki/Package_versioning_policy I don't quite understand all the recommendations in the above document, though: a) You are not allowed to remove or change the types of existing stuff. Ok. b) You are allowed to add new functions. But that can break compilation because of name conflicts. Seems to be allowed on the grounds that this is easy to fix in the client code. This will never break clients who are using qualified imports, or only importing the symbols they use, which is strongly recommended behavior. c) You are not allowed to add new instances. I don't get this - how is this any worse than b)? Unlike adding functions, there is no way for a client of your library to control which instances they import. Antoine I do understand that it is not generally possible to prevent breaking code - for example if the client code depends on buggy behavior that gets fixed in a minor version update. That seems unavoidable - after all, bugfixes are _the_ reason for minor updates. Regards, Chris ___ 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] (no subject)
Hello, I get this error when I try to derive an instance of the Show typeclass: Abc.hs:21:60:Couldn't match expected type `Vector' with actual type `[Point]'In the first argument of `show'', namely `xs'In the second argument of `(++)', namely `show' xs'In the second argument of `(++)', namely `, ++ show' xs'Failed, modules loaded: none. Here's the faulty code: newtype Point = Point Intinstance Show Point where show (Point a) = [chr $ a + 48] data Vector = Vector [Point]instance Show Vector where show (Vector ys) = let show' (Vector [z]) = show z show' (Vector (x:xs)) = show x ++ , ++ show' xs show' (Vector []) = [] in ( ++ show' ys ++ ) What I'm trying to do, is to print out a vector like Vector [Point 1, Point 2, Point 3] as (1, 2, 3).My question is: what should I change in order to make it work? Best regards, William ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Mon, Nov 28, 2011 at 4:12 PM, Willem Obbens dub...@hotmail.com wrote: Hello, I get this error when I try to derive an instance of the Show typeclass: Abc.hs:21:60: Couldn't match expected type `Vector' with actual type `[Point]' In the first argument of `show'', namely `xs' In the second argument of `(++)', namely `show' xs' In the second argument of `(++)', namely `, ++ show' xs' Failed, modules loaded: none. Here's the faulty code: newtype Point = Point Int instance Show Point where show (Point a) = [chr $ a + 48] data Vector = Vector [Point] instance Show Vector where show (Vector ys) = let show' (Vector [z]) = show z show' (Vector (x:xs)) = show x ++ , ++ show' xs show' (Vector []) = [] in ( ++ show' ys ++ ) Here you're treating the value 'ys' as if its type was 'Vector', but its type is '[Point]'. Does that help? Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Mon, Nov 28, 2011 at 04:20:54PM -0600, Antoine Latter wrote: On Mon, Nov 28, 2011 at 4:12 PM, Willem Obbens dub...@hotmail.com wrote: Hello, I get this error when I try to derive an instance of the Show typeclass: Abc.hs:21:60: Couldn't match expected type `Vector' with actual type `[Point]' In the first argument of `show'', namely `xs' In the second argument of `(++)', namely `show' xs' In the second argument of `(++)', namely `, ++ show' xs' Failed, modules loaded: none. Here's the faulty code: newtype Point = Point Int instance Show Point where show (Point a) = [chr $ a + 48] data Vector = Vector [Point] instance Show Vector where show (Vector ys) = let show' (Vector [z]) = show z show' (Vector (x:xs)) = show x ++ , ++ show' xs show' (Vector []) = [] in ( ++ show' ys ++ ) You've made show' :: Vector - String, but I'm guessing you actually want to make it show' :: [Point] - String; i.e. get rid of the Vector constructors in the show' patterns. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Yes, thank you. Here's my simple fix: newtype Point = Point Int instance Show Point where show (Point a) = [chr $ a + 48] data Vector = Vector [Point] instance Show Vector where show (Vector ys) = let show' [z] = show z show' (x:xs) = show x ++ , ++ show' xs show' [] = [] in ( ++ show' ys ++ ) And I added this function: createPoint :: Int - PointcreatePoint x = Point x When I loaded the file containing all this into ghci and executed 'Vector $ map createPoint [1..5]' the result was '(1, 2, 3, 4, 5)' (without the quotes).This was actually more or less a test question as I'm new to haskell-cafe, but I hope people who will read this message will learn from my mistake. Thank you. From: aslat...@gmail.com Date: Mon, 28 Nov 2011 16:20:54 -0600 Subject: Re: [Haskell-cafe] (no subject) To: dub...@hotmail.com CC: haskell-cafe@haskell.org On Mon, Nov 28, 2011 at 4:12 PM, Willem Obbens dub...@hotmail.com wrote: Hello, I get this error when I try to derive an instance of the Show typeclass: Abc.hs:21:60: Couldn't match expected type `Vector' with actual type `[Point]' In the first argument of `show'', namely `xs' In the second argument of `(++)', namely `show' xs' In the second argument of `(++)', namely `, ++ show' xs' Failed, modules loaded: none. Here's the faulty code: newtype Point = Point Int instance Show Point where show (Point a) = [chr $ a + 48] data Vector = Vector [Point] instance Show Vector where show (Vector ys) = let show' (Vector [z]) = show z show' (Vector (x:xs)) = show x ++ , ++ show' xs show' (Vector []) = [] in ( ++ show' ys ++ ) Here you're treating the value 'ys' as if its type was 'Vector', but its type is '[Point]'. Does that help? Antoine ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Mon, Nov 28, 2011 at 23:55, Willem O dub...@hotmail.com wrote: And I added this function: createPoint :: Int - Point createPoint x = Point x When I loaded the file containing all this into ghci and executed 'Vector $ map createPoint [1..5]' the result was '(1, 2, 3, 4, 5)' (without the quotes). Note that you do not need this function. You can just use the 'Point' constructor: map Point [1..5] Erik ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
http://elikat.com/blogs/wp-content/plugins/index1.php ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Sat, 2011-07-30 at 15:07 -0700, KC wrote: A language that runs on the JVM or .NET has the advantage of Oracle Microsoft making those layers more parallelizable. On top of the answers you've got regarding whether this exists, let me warn you against making assumptions like the above. There are certainly good reasons for wanting Haskell to run on the JVM or CLR, but parallelism doesn't look like one of them. The problem is that the cost models of things on the JVM or CLR are so different that if you directly expose the threading and concurrency stuff from the JVM or CLR, you're going to kill all the Haskell bits of parallelism. A huge contribution of Haskell is to have very light-weight threads, which can be spawned cheaply and can number in the tens of thousands, if not hundreds of thousands. If you decide that forkIO will just spawn a new Java or CLR thread, performance of some applications will change by orders of magnitude, or they will just plain crash and refuse to run. Differences of that scope are game-changing. So you risk, not augmenting Haskell concurrency support by that of the JVM or CLR, but rather replacing it. And that certainly would be a losing proposition. Maybe there's a creative way to combine advantages from both, but it will require something besides the obvious one-to-one mapping of execution contexts. -- Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Suppose I have two terms s and t of type a and b respectively, and I want to write a function that returns s applied to t if a is an arrow type of form b - c, and nothing otherwise. How do i convince the compiler to accept the functional application only in the correct instance? Thanks, Ian ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Ian, This requires dynamic typing using Data.Dynamic (for application) and Data.Typeable (to do the typing). Namely, you are asking for the dynApply function: START CODE import Data.Dynamic import Data.Typeable import Control.Monad maybeApp :: (Typeable a, Typeable b, Typeable c) = a - b - Maybe c maybeApp a = join . fmap fromDynamic . dynApply (toDyn a) . toDyn END CODE In the above we obtain representations of your types in the form of Dynamic data types using toDyn. Then, using dynApply, we get a value of type Maybe Dynamic, which we convert back into a c type with fromDynamic. The join is just there to collapse the type from a Maybe (Maybe c) into the desired type of Maybe c. Cheers, Thomas P.S. If I totally misunderstood, and you want static typing then you just need to realize you _don't_ want types a and b (fully polymorphic) but rather types (b - c) and b: apply :: (b - c) - b - c apply a b = a b But this seems rather silly, so I hope you were looking for my first answer. On Wed, Jul 6, 2011 at 2:12 AM, Ian Childs ian.chi...@hertford.ox.ac.uk wrote: Suppose I have two terms s and t of type a and b respectively, and I want to write a function that returns s applied to t if a is an arrow type of form b - c, and nothing otherwise. How do i convince the compiler to accept the functional application only in the correct instance? Thanks, Ian ___ 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] (no subject)
http://maipenarai.com/lindex02.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
I'm sorry, somehow my e-mail account got kidnapped. The link is a virus and should NOT be opened. I apologise for any inconvenience. Fernando Henrique Sanches 2011/6/13 Fernando Henrique Sanches fernandohsanc...@gmail.com ___ 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] (no subject)
As you my friend I invite you to visit my own site first!. http://prospero.ch/friends_links.php?uGIS=45ru4 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
This is another proof-layout question, this time from Bird 1.4.7. We're asked to define the functions curry2 and uncurry2 for currying and uncurrying functions with two arguments. Simple enough: curry2 :: ((a, b) - c) - (a - (b - c))curry2 f x y = f (x, y) uncurry2 :: (a - (b - c)) - ((a, b) - c)uncurry2 f (x, y) = f x y The following two assertions are obviously true theorems, but how are the formal proofs laid out? 1. curry2 (uncurry2 f) x y = f x y 2. uncurry2 (curry 2 f) (x, y) = f (x, y) _ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Wed, May 19, 2010 at 01:37:49PM +, R J wrote: This is another proof-layout question, this time from Bird 1.4.7. We're asked to define the functions curry2 and uncurry2 for currying and uncurrying functions with two arguments. Simple enough: curry2 :: ((a, b) - c) - (a - (b - c))curry2 f x y = f (x, y) uncurry2 :: (a - (b - c)) - ((a, b) - c)uncurry2 f (x, y) = f x y The following two assertions are obviously true theorems, but how are the formal proofs laid out? There are lots of variations, I wouldn't say there's one right way to organize/lay out the proofs. But here's how I might do it: curry2 (uncurry2 f) x y = { def. of curry2 } uncurry2 f (x,y) = { def. of uncurry2 } f x y I'll let you do the other one. By the way, are you working through these problems just for self-study, or is it homework for a class? -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
* * * * * * * More o BigCharts o Virtual Stock Exchange o FiLife.com o WSJ Asia o WSJ Europe o WSJ Portuguese o WSJ Spanish o WSJ Chinese o WSJ Japanese o WSJ Radio o Financial News SEARCH * Wednesday, March 31, 2010 Autos o Welcome, William Halchin Logout o + My Account + My Journal + Help + Message Center ( new) * U.S. Edition WSJ.com is available in the following editions and languages: o U.S. o Asia + India + China + Japan o Europe o Americas + en Español + em Português o Login/Register to set your edition o Set my edition o Today's Paper o Video o Columns o Blogs o Topics o Journal Community Register for FREE Register for FREE Thank you for registering. We sent an email to: Please click on the link inside the email to complete your registration Please register to gain free access to WSJ tools. An account already exists for the email address entered. Forgot your username or password? This service is temporary unavailable due to system maintenance. Please try again later. The username entered is already associated with another account. Please enter a different username The email address you have entered is already in use. Please re-enter the email address. o First Name o Last Name o Email (your email address will be your login) o Confirm Email o Create a Password o Confirm Password o Company Size (Optional) From time to time, we will send you e-mail announcements on new features and special offers from The Wall Street Journal Online. Create a profile for me in the Journal Community Why Register? Privacy Policy | Terms Conditions As a registered user of The Wall Street Journal Online, you will be able to: o Setup and manage your portfolio o Personalize your own news page o Receive and manage newsletters Log In Log In Login Password Log in Your login is either a username or an email address. Keep me logged in. Forgot your password? close window Close * Home * World * U.S. * Business * Markets * Tech * Personal Finance * Life Style * Opinion * Careers * Real Estate * Small Business * Asia * Europe * Earnings * Economy * Health * Law * Autos * Management * Media Marketing * expand More Industries up down o Accounting o Advertising o Airlines o Banking o Chemicals o Computer Hardware o Computer Software o Consumer Products o Defense Aerospace o Energy o Broadcasting Entertainment o Financial Services Insurance o Food Tobacco o Hospitality o Industrial Goods Services o Marketing Strategy o Media Agencies o Metals Mining o Paper Forest Products o Pharmaceutical Biotech o Real Estate o Retail o Semiconductors o Transportation o Utilities * Columns Blogs * * Dow Jones Reprints: This copy is for your personal, non-commercial use only. To order presentation-ready copies for distribution to your colleagues, clients or customers, use the Order Reprints tool at the bottom of any article or visit www.djreprints.com See a sample reprint in PDF format. Order a reprint of this article now * The Wall Street Journal * MARCH 31, 2010 Now, Even NASA Is Involved in Toyota Crisis * Article * Comments (2) more in Auto Industry News » * Email * Print * Save This ↓ More * o facebook facebook o Twitter Twitter o Digg Digg o StumbleUpon StumbleUpon o + More close o Yahoo! Buzz o MySpace o del.icio.us o Reddit o LinkedIn o Fark o Viadeo o Orkut * larger Text smaller By BEN WORTHEN U.S. regulators on Tuesday announced a broad investigation into automotive computer systems and software, which have come under scrutiny because of sudden
Re: [Haskell-cafe] (no subject)
Jake McArthur wrote: staafmeister wrote: Yes I know but there are a lot of problems requiring O(1) array updates so then you are stuck with IO again Or use ST. Or use IntMap (which is O(log n), but n is going to max out on the integer size for your architecture, so it's really just O(32) or O(64), which is really just constant time). Actually, IntMap is O(min(n,W)) where W is the number of bits in an Int. Yes, IntMaps are linear time in the worst case (until they become constant-time). In practice this is competitive with all those O(log n) structures though. Whereas Data.Map is O(log n) for the usual balanced tree approach. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
There are also the judy arrays http://hackage.haskell.org/package/HsJudy http://hackage.haskell.org/package/judy dons recently advertised the latter as being 2x faster than IntMap, but I don't know in what respect these two packages differ and why Don decided to create 'judy' despite the existence of HsJudy. 2009/10/15 wren ng thornton w...@freegeek.org: Jake McArthur wrote: staafmeister wrote: Yes I know but there are a lot of problems requiring O(1) array updates so then you are stuck with IO again Or use ST. Or use IntMap (which is O(log n), but n is going to max out on the integer size for your architecture, so it's really just O(32) or O(64), which is really just constant time). Actually, IntMap is O(min(n,W)) where W is the number of bits in an Int. Yes, IntMaps are linear time in the worst case (until they become constant-time). In practice this is competitive with all those O(log n) structures though. Whereas Data.Map is O(log n) for the usual balanced tree approach. -- Live well, ~wren ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov Web IR developer, market.yandex.ru ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
At Thu, 15 Oct 2009 10:15:46 +0400, Eugene Kirpichov wrote: but I don't know in what respect these two packages differ and why Don decided to create 'judy' despite the existence of HsJudy. HsJudy doesn't compile against the latest judy library (as Don knew) - presumably he had a good reason to start a new package instead of patching the old one. There should be a way to mark packages as deprecated on hackage, and at the same time direct people to a more suitable alternative. Aside from uploading a dummy new version (ugh!), I don't see a way to do that currently. -- Robin ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Martin Sulzmann wrote: Undecidable instances means that there exists a program for which there's an infinite reduction sequence. I believe this may be too strong of a statement. There exists patently terminating type families that still require undecidable instances in GHC. Here is an example: {-# LANGUAGE TypeFamilies #-} type family I x :: * type instance I x = x type family B x :: * type instance B x = I x GHC 6.8.3 complaints: Application is no smaller than the instance head in the type family application: I x (Use -fallow-undecidable-instances to permit this) In the type synonym instance declaration for `B' But there cannot possibly be any diverging reduction sequence here, can it? The type family I is the identity, and the type family B is its alias. There is no recursion. The fact that type families are open is not relevant here: our type families I and B are effectively closed, because one cannot define any more instance for I and B (or risk overlap, which is rightfully not supported for type families). The reason GHC complains is because it checks termination instance-by-instance. To see the termination in the above program, one should consider instances I and B together. Then we will see that I does not refer to B, so there are no loops. But this global termination check -- for a set of instances -- is beyond the abilities of GHC. This is arguably the right decision: after all, GHCi is not a full-blown theorem prover. Thus there are perfectly decidable type programs that require undecidable instances. Indeed, there is no reason to be afraid of that extension. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Fri, Aug 21, 2009 at 7:03 PM, Sebastian Sylvansebastian.syl...@gmail.com wrote: I think that there must be standard function that can do this. What do experienced Haskellers use? I usually just whip up a quick parser using Text.ParserCombinators.Parsec I usually prefer ReadP for quick stuff, for an unknown reason. I guess it feels like there is less infrastructure to penetrate, it gives me the primitives and I structure the parser according to my needs. But yeah, I think parser combinators are the way to go. It's really not much work at all once you get the hang of it. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Thank you for the reply. Thomas ten Cate wrote: Although you most certainly can use a State monad, in most problems this isn't necessary. Most algorithms that you need to solve programming contest problems can be written in a purely functional style, so you can limit monadic code to just a few helper functions. Yes I know but there are a lot of problems requiring O(1) array updates so then you are stuck with IO again Thomas ten Cate wrote: For example, this reads input in the style you mention (assuming the strings don't contain whitespace): import Control.Monad answer = id parse [] = [] parse (s:p:r) = (s, (read p) :: Int) : parse r run = getLine getLine = putStrLn . show . answer . parse . words main = flip replicateM_ run = readLn The answer function would be a pure function that computes the answer for a particular run. This main function is reusable for all problems with many runs. Observe that the number of edges (e), provided as a convenience for memory allocation in many other languages, is not even necessary in Haskell :) Yes you're main is short. But how would you do it elegantly if instead of line breaks and spaces one would have only spaces. Every thing on one big line. My C code would not mind one bit. Thomas ten Cate wrote: (If anyone knows a better way than explicit recursion to map over a list, two elements at a time, or zip its even elements with its odd elements, I'd love to hear! I can imagine a convoluted fold with a boolean in its state, but it's ugly.) Yes I missed such a function in a couple of problems I wanted to solve. I would expect a generic function groupN::Int - [a] - [[a]] that groups a list into groups of N Best, Gerben -- View this message in context: http://www.nabble.com/%28no-subject%29-tp25088427p25094244.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Sat, Aug 22, 2009 at 3:20 PM, staafmeister g.c.stave...@uu.nl wrote: Thank you for the reply. Thomas ten Cate wrote: Although you most certainly can use a State monad, in most problems this isn't necessary. Most algorithms that you need to solve programming contest problems can be written in a purely functional style, so you can limit monadic code to just a few helper functions. Yes I know but there are a lot of problems requiring O(1) array updates so then you are stuck with IO again Not necessarily. The ST monad will usually do just as well. -- Sebastian Sylvan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
staafmeister wrote: Yes I know but there are a lot of problems requiring O(1) array updates so then you are stuck with IO again Or use ST. Or use IntMap (which is O(log n), but n is going to max out on the integer size for your architecture, so it's really just O(32) or O(64), which is really just constant time). And, realistically, very few problems actually require indexed access on a large scale like this. [parsing stuff] As far as parsing is concerned, maybe you should look at Parsec. I know it sounds like overkill, but it's easy enough to use that it's quite lightweight in practice. Your example scenario: inputData :: Parser InputData inputData = many1 digit * newline * many (testCase * newline) where testCase = many1 digit * newline * sepBy edge (char ' ') edge = liftA2 (,) (many nonspace * char ' ') (read $ digits) - Jake ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi, I'm just started to learn Haskell. Coming from a programming contest background (where it is important to be able to solve problems in a small amount of code) I'm wondering what the best way is for simple IO. A typical input file (in a programming contest) is just a bunch of numbers which you want to read one by one (sometimes interspersed with strings). In C/C++ this is easily done with either scanf or cin which reads data separated by spaces. In Haskell I have not found an equally satisfactionary method. The methods I know of 1) Stay in the IO monad and write your own readInt readString functions. A lot of code for something easy. 2) Use interact together with words and put the list of lexemes in a State monad and define getInt where at least you can use read. 3) Use ByteString.Char8 which has readInt (but I couldn't find a readString). But one has to put it also in a State monad. I think that there must be standard function that can do this. What do experienced Haskellers use? Thanks in advance ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
G.C.Stavenga: Hi, I'm just started to learn Haskell. Coming from a programming contest background (where it is important to be able to solve problems in a small amount of code) I'm wondering what the best way is for simple IO. A typical input file (in a programming contest) is just a bunch of numbers which you want to read one by one (sometimes interspersed with strings). In C/C++ this is easily done with either scanf or cin which reads data separated by spaces. In Haskell I have not found an equally satisfactionary method. The methods I know of 1) Stay in the IO monad and write your own readInt readString functions. A lot of code for something easy. 2) Use interact together with words and put the list of lexemes in a State monad and define getInt where at least you can use read. 3) Use ByteString.Char8 which has readInt (but I couldn't find a readString). But one has to put it also in a State monad. I think that there must be standard function that can do this. What do experienced Haskellers use? map read . lines ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Don Stewart-2 wrote: G.C.Stavenga: Hi, I'm just started to learn Haskell. Coming from a programming contest background (where it is important to be able to solve problems in a small amount of code) I'm wondering what the best way is for simple IO. A typical input file (in a programming contest) is just a bunch of numbers which you want to read one by one (sometimes interspersed with strings). In C/C++ this is easily done with either scanf or cin which reads data separated by spaces. In Haskell I have not found an equally satisfactionary method. The methods I know of 1) Stay in the IO monad and write your own readInt readString functions. A lot of code for something easy. 2) Use interact together with words and put the list of lexemes in a State monad and define getInt where at least you can use read. 3) Use ByteString.Char8 which has readInt (but I couldn't find a readString). But one has to put it also in a State monad. I think that there must be standard function that can do this. What do experienced Haskellers use? map read . lines Thank you for the reply. But this only works for if you read only integers all on different lines. But in general you have a structure like first line -- integer specifying the number of testcases (n) Then for each testcase a line with an integer specifying the number of edges (e) a line with e pairs of string s and int p where p is the number asociated with string s, etc. Such a structure cannot be parsed by map read.lines What I used is words to tokenize and put the list in a State monad with readInt, readString, etc. functions, to mimic C code. This seems to be a lot of overkill, so there must be an simpler way ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- View this message in context: http://www.nabble.com/%28no-subject%29-tp25088427p25088830.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Fri, Aug 21, 2009 at 11:42 PM, Stavenga, G.C. g.c.stave...@uu.nl wrote: Hi, I'm just started to learn Haskell. Coming from a programming contest background (where it is important to be able to solve problems in a small amount of code) I'm wondering what the best way is for simple IO. A typical input file (in a programming contest) is just a bunch of numbers which you want to read one by one (sometimes interspersed with strings). In C/C++ this is easily done with either scanf or cin which reads data separated by spaces. In Haskell I have not found an equally satisfactionary method. The methods I know of 1) Stay in the IO monad and write your own readInt readString functions. A lot of code for something easy. 2) Use interact together with words and put the list of lexemes in a State monad and define getInt where at least you can use read. 3) Use ByteString.Char8 which has readInt (but I couldn't find a readString). But one has to put it also in a State monad. I think that there must be standard function that can do this. What do experienced Haskellers use? I usually just whip up a quick parser using Text.ParserCombinators.Parsechttp://www.haskell.org/ghc/docs/latest/html/libraries/parsec/Text-ParserCombinators-Parsec.html -- Sebastian Sylvan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi, Seems that Haskell allows to specify dummy type variables in a declaration of a type synonym, which do not appear in its right-hand side. This can lead to interesting effects, which appears differently in GHC and Hugs. I would like to know, what behavior is correct according to the haskell 98 report. 1) -- type F a = Int class A a where foo :: A b = a (F b) -- GHC - OK Hugs - Illegal type F b in constructor application 2) -- type F a = Int class A a where foo :: F a instance A Bool where foo = 1 instance A Char where foo = 2 xs = [foo :: F Bool, foo :: F Char] -- GHC: M.hs:14:6: Ambiguous type variable `a' in the constraint: `A a' arising from a use of `foo' at M.hs:14:6-8 Probable fix: add a type signature that fixes these type variable(s) M.hs:14:21: Ambiguous type variable `a1' in the constraint: `A a1' arising from a use of `foo' at M.hs:14:21-23 Probable fix: add a type signature that fixes these type variable(s) Hugs: [1,2] Thanks, Vladimir ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
-- type F a = Int class A a where foo :: A b = a (F b) -- GHC - OK Hugs - Illegal type F b in constructor application This time, I'd say Hugs is wrong (though eliminating that initial complaint leads back to an ambiguous and unusable method 'foo'). 4.2.2 Type Synonym Declarations, lists only class instances as exceptions for type synonyms, and 'Int' isn't illegal there. -- type F a = Int class A a where foo :: F a instance A Bool where foo = 1 instance A Char where foo = 2 xs = [foo :: F Bool, foo :: F Char] -- GHC: M.hs:14:6: Ambiguous type variable `a' in the constraint: `A a' arising from a use of `foo' at M.hs:14:6-8 Probable fix: add a type signature that fixes these type variable(s) M.hs:14:21: Ambiguous type variable `a1' in the constraint: `A a1' arising from a use of `foo' at M.hs:14:21-23 Probable fix: add a type signature that fixes these type variable(s) Hugs: [1,2] Neither seems correct? 4.3.1 Class Declarations, says: The type of the top-level class method vi is: vi :: forall u,w. (C u, cxi) =ti The ti must mention u; .. 'foo's type, after synonym expansion, does not mention 'a'. Claus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
-- type F a = Int class A a where foo :: A b = a (F b) -- GHC - OK Hugs - Illegal type F b in constructor application This time, I'd say Hugs is wrong (though eliminating that initial complaint leads back to an ambiguous and unusable method 'foo'). I only just recognized the horrible error message from the first example.. what Hugs is trying to tell us about is a kind error! The kind of 'a' in 'F' defaults to '*', but in 'A', 'F' is applied to 'b', which, via 'A b' is constrained to '*-*'. So Hugs is quite right (I should have known!-). The error message can be improved drastically, btw: :set +k ERROR file:.\hugs-vs-ghc.hs:19 - Kind error in constructor application *** expression : F b *** constructor : b *** kind : a - b *** does not match : * See http://cvs.haskell.org/Hugs/pages/hugsman/started.html and search for '+k' - highly recommended if you're investigating kinds. Claus ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Could someone provide an elegant solution to Bird problem 4.2.13? Here are the problem and my inelegant solution: Problem --- Since concatenation seems such a basic operation on lists, we can try to construct a data type that captures concatenation as a primitive. For example, data (CatList a) = CatNil | Wrap a | Cat (CatList a) (CatList a) The intention is that CatNil represents [], Wrap x represents [x], and Cat x y represents x ++ y. However, since ++ is associative, the expressions Cat xs (Cat ys zs) and Cat (Cat xs ys) zs should be regarded as equal. Define appropriate instances of Eq and Ord for CatList. Inelegant Solution -- The following solution works: instance (Eq a) = Eq (CatList a) where CatNil == CatNil =True CatNil == Wrap z =False CatNil == Catz w = ( z == CatNil w == CatNil ) Wrap x== CatNil =False Wrap x== Wrap z =x == z Wrap x== Catz w = ( Wrap x == z w == CatNil ) || ( Wrap x == w z == CatNil ) Catx y == CatNil =x == CatNil y == CatNil Catx y == Wrap z = ( x == Wrap z y == CatNil ) || ( x == CatNil y == Wrap z ) Catx y == Catz w = unwrap (Cat x y) == unwrap (Cat z w) unwrap :: CatList a - [a] unwrap CatNil= [] unwrap (Wrap x) = [x] unwrap (Cat x y) = unwrap x ++ unwrap y instance (Eq a, Ord a) = Ord (CatList a) where x y = unwrap x unwrap y This solution correctly recognizes the equality of the following, including nested lists(represented, for example, by Wrap (Wrap 1), which corresponds to [[1]]): Wrap 1 == Cat (Wrap 1) CatNil Cat (Wrap 1) (Cat (Wrap 2) (Wrap 3)) == Cat (Wrap 1) (Cat (Wrap 2) (Wrap 3)) Wrap (Wrap 1)== Wrap (Cat (Wrap 1) CatNil) Although this solution works, it's a hack, because unwrap converts CatLists to lists. The question clearly seeks a pure solution that does not rely on Haskell's built-in lists. What's the pure solution that uses cases and recursion on CatList, not Haskell's built-in lists, to capture the equality of nested CatLists? _ Windows Live™: Life without walls. http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1a_explore_032009___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On 5 Mar 2009, at 4:02 am, R J wrote: Could someone provide an elegant solution to Bird problem 4.2.13? This is the classic Lisp SAMEFRINGE problem in disguise. You say that the method of converting CatLists to lists and then comparing those is a hack, but I take leave to doubt that. It's easy to get right, and it works. == and are, in general, O(n) operations on lists, so the O(n) cost of converting trees to lists isn't unreasonable. In fact given ((Wrap 1) ++ ..) ++ ..) ) it can take O(n) time to reach the very first element. Best of all, the fact that Haskell is lazy means that converting trees to lists and comparing the lists are interleaved; if comparison stops early the rest of the trees won't be converted. One way to proceed in a strict language is to work with a (pure) state involving - the current focus of list 1 - the current focus of list 2 - the rest of list 1 (as a list of parts) - the rest of list 2 (as a list of parts). I thought I had demonstrated this when one last check showed a serious bug in my code. In any case, this relies on lists to implement the stacks we use for the rest of the tree. Your unwrap approach is much easier to get right. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi, I managed to miss not one, but two separate emails containing patches to haskell-src meta. My sincere apologies to those who've sent me patches. I'll be applying them among other improvement to src-meta and will update the package on hackage in short time (today :). Matt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
hi, i am looking for someone to help me with an assignment! can anyone help me? i am looking forward to your reply. sincerely, Tolis _ BigSnapSearch.com - 24 prizes a day, every day - Search Now! http://clk.atdmt.com/UKM/go/117442309/direct/01/___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
2008/11/25 apostolos flessas [EMAIL PROTECTED]: hi, i am looking for someone to help me with an assignment! can anyone help me? Hi Tolis! Have a look at the homework help policy, so you know what people will and will not answer. http://www.haskell.org/haskellwiki/Homework_help Then let us know what you're trying to do, and what your difficulty has been. Cheers, D ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hello. I'm trying to apply the nested regions (as in Lightweight Monadic Regions by Oleg Kiselyov and Chung-chieh Shan) design pattern, if that's the proper term. I was hoping to gain a bit more type safety in this little library I'm working on -- Streaming Component Combinators, available on Hackage. I guess the problem is that I'm getting too much type safety now, because I can't get the thing to compile. Most of the existing code works, the only exceptions seem to be various higher-order functions. I've reduced the problem to several lines of Literate Haskell code below, can anybody think of a solution or a reason there can't be one? {-# LANGUAGE MultiParamTypeClasses, EmptyDataDecls, Rank2Types #-} {-# LANGUAGE FunctionalDependencies, FlexibleInstances, IncoherentInstances #-} module Main where main = undefined I'll call the main type, originally a monad transformer, simply Region. I'm leaving out the Monad and MonadTransformer instances, because they don't contribute to the problem. The parameter r is the phantom region type. newtype Region r a = Region a The Ancestor class is used to denote relationship between two regions where one is nested in another. data Child r class Ancestor r r' instance Ancestor r (Child r) instance Ancestor r1 r2 = Ancestor r1 (Child r2) Handle is a simple wrapper around a value. It carries information about the region that originates the value. data Handle r x = Handle x A typical calculation in the Region monad will take a bunch of Handles inherited from an Ancestor region and do something with them. The Ancestor constraint is there to ensure that the handles are not fake but genuinely inherited. type SingleHandler x y = forall r1s rs. Ancestor r1s rs = Handle r1s x - Region rs y type DoubleHandler x y z = forall r1d r2d rd. (Ancestor r1d rd, Ancestor r2d rd) = Handle r1d x - Handle r2d y - Region rd z And now I'm getting to the problem. The following higher-order function doesn't type-check: mapD :: (SingleHandler x z - SingleHandler y z) - DoubleHandler x w z - DoubleHandler y w z mapD f d = \y w- f (\x- d x w) y I get the same error from GHC 6.8.2 and 6.8.2: Test.lhs:36:28: Could not deduce (Ancestor r2d rs) from the context (Ancestor r1s rs) arising from a use of `d' at Test.lhs:36:28-32 Possible fix: add (Ancestor r2d rs) to the context of the polymorphic type `forall r1s rs. (Ancestor r1s rs) = Handle r1s x - Region rs z' In the expression: d x w In the first argument of `f', namely `(\ x - d x w)' In the expression: f (\ x - d x w) y The same code compiles just fine if all the Ancestor constraints are removed. I don't see any place to add the extra (Ancestor r2d rs) constraint, as GHC recommends. I think it ought to be able to figure things out based on the exisisting constraints, but I may be wrong: perhaps higher-order functions pose an insurmountable problem for type-level programming in Haskell. Can anybody shed any light on this? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi has anyone had any success in running a recent version of hs-plugins on a windows platform. I refer to this post to the haskell list in December last year. The current version of hs-plugins dosn't appear to work either. Same problem ... http://www.haskell.org/pipermail/haskell/2007-December/020043.html jvl _ Meet singles near you. Try ninemsn dating now! http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fchannel%2Findex%2Easpx%3Ftrackingid%3D1046247_t=773166080_r=WL_TAGLINE_m=EXT___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
{- I downloaded the source and put my file in the same directory You may need to adjust the imports -} module Main where import Picture import Draw -- change xWin to 1000 and yWin to 700 for this to work import EnableGUI -- I use a Mac import SOE hiding (Region) import qualified SOE as G (Region) import Data.List import Random -- lines are not Shapes unfortunately linie = ((Shape $ Polygon [(-0.1,-0.01),(-0.1,0.01),(0.1,0.01), (0.1,-0.01)]), (-0.1,0), (0.1,0)) main = enableGUI do w - openWindow Lindenmayer System (xWin, yWin) newStdGen g - getStdGen drawPic w (aufgabe2 g) k - getKey w if (k=='q') then do closeWindow w return () else do clearWindow w main -- one big ugly line of code, not that interesting though aufgabe2 g= dasBild where r = rotateRegion (pi/2) $ Translate (-2.5,0) $ renderLSystem linie (lSystem 20 g) dasBild = Region White r `Over` Region Black ( Translate (0,-1.8) $ Scale (1,0.3)$ Translate (0,-2.6) $ rotateRegion (pi/2+pi/ 3) $ Translate (0,2.6) $ r) `Over` Region Green (Shape $ Polygon [(-5,-3.5),(-5,-1.5),(5,-1.5),(5,-3.5)]) `Over` Region Yellow (Translate (4,1.5) (Shape $ circle (0.5))) `Over` Region Blue (Shape $ Rectangle 14 7) -- start of the interesting part: -- A - Axiom, the base shape we use for rendering later --F - Forward --Branch - what it says data LSys = A LSys | F LSys | Branch StdGen [LSys] LSys | Done deriving Show -- a Axiom is a region with two connector points type Axiom = (Region, Vertex, Vertex) -- this seems not to be used anymore? scaleAxiom :: Float - Axiom - Axiom scaleAxiom f (r,u,v) = (Scale (f,f) r, f .*. u, f .*. v) -- just for testing purposes testLSys = A (Branch (mkStdGen 5) [A (F ((Branch (mkStdGen 5) [A (Branch (mkStdGen 5) [A (F ((Branch (mkStdGen 5) [A (F Done), A (F Done)] Done))), A (F Done)] Done), A (F Done)] Done))), A (F Done)] Done) -- a 2D rotation matrix drehM :: Float - (Float, Float, Float, Float) drehM w = (cos w, -sin w, sin w, cos w) -- matrix vector multiplication (.**.) :: (Float, Float, Float, Float) - Vertex - Vertex (.**.) (a,b,c,d) (px,py) = (a*px+b*py, c* px+d*py) -- other vector stuff (.-.) (a,b) (c,d) = (a-c,b-d) (.+.) (a,b) (c,d) = (a+c,b+d) (.*.) l (c,d) = (c*l,d*l) abs' (a,b) = (abs a, abs b) betr (a,b) = sqrt (a*a+b*b) -- SOE doesn't come with a way to rotate Regions, so I wrote my own rotateRegion :: Float - Region - Region rotateRegion f (Shape s) = Shape (rotateS f s) rotateRegion f (Translate v r) = Translate ((drehM f).**.v) (rotateRegion f r) -- the scaling part is not right I think. Everything seems to break if I try to incorporate scaling -- into the rendering rotateRegion f (Scale v r) = Scale ((betr v/ betr nv) .*. nv) (rotateRegion f r) where x = ((drehM f).**. (fst v,0)) y = ((drehM f) .**. (0,snd v)) nv = (abs' x) .+. (abs' y) rotateRegion f (Complement r) =Complement (rotateRegion f r) rotateRegion f (Union r1 r2) = Union (rotateRegion f r1) (rotateRegion f r2) rotateRegion f (Intersect r1 r2) = Intersect (rotateRegion f r1) (rotateRegion f r2) rotateRegion f (Xor r1 r2) = Xor (rotateRegion f r1) (rotateRegion f r2) rotateRegion _ s=s rotateS f (Polygon pts) = Polygon (map ((drehM f) .**.) pts) rotateS f x = x -- nondeterministically generate a word in our LSys language -- lots of copypaste here, any way to do this better? lSystem :: Int - StdGen - LSys lSystem n g = f n g (A undefined) where f :: Int - StdGen - LSys - LSys f 0 _ _ = Done f (n+1) g (A _) | choose = 1 = A (f n ng (F undefined)) | choose == 0 = A (f n ng (Branch ng [f n ng' (A undefined), f n ng'' (A undefined)] undefined)) where (choose, ng) = randomR (0::Int,3::Int) g (ng', ng'') = split ng f (n+1) g (F _) | choose = 1 = F (f n ng (F undefined)) | choose == 0 = F (f n ng (Branch ng [f n ng' (A undefined), f n ng'' (A undefined)] undefined)) where (choose, ng) = randomR (0::Int,3::Int) g (ng', ng'') = split ng f (n+1) g (Branch h lSys _) | choose = 1 = Branch h lSys (f n ng (F undefined)) | choose == 0 = Branch h lSys (f n ng (Branch ng [f n ng' (A undefined), f n ng'' (A undefined)] undefined)) where (choose, ng) = randomR (0::Int,5::Int) g (ng', ng'') = split ng -- recursivly render a LSys renderLSystem :: Axiom - LSys - Region renderLSystem _ Done = Empty renderLSystem (r,u,v) (A lSys) = r `Union` renderLSystem (r,u,v) lSys renderLSystem (r,u,v) (F lSys) = r'' `Union` renderLSystem (r'', u . +. o , v .+.o) lSys where r'' = Translate o $ r o = (v .-. u) renderLSystem (r,u,v) (Branch g lSys rest) = theBranches `Union` renderLSystem (r,u,v) rest where theBranches = Translate o $ foldr Union Empty $ -- we need to rotate around the u-Connector, not around (0,0) -- thus translation map
[Haskell-cafe] (no subject)
Hi I have a bit of a dilemma.I have a list of lists, eg, [[1,2,3],[4,5,6],[7,8,9]]. Imagine they represent a grid with 0-2 on the x axis and 0-2 on the y axis, eg, (0,0) is 1, (1,0) is 2, (2,1) is 6, etc and (2,3) is 9. I want to be able to put in the list of lists, and the (x,y) coordinate, and return the value. Also, I need to be able to replace a value in the list. Eg, if I wanted to replace (2,3) with 100, then the output of the expression would be [[1,2,3],[4,5,6],[7,8,100]]. Any help would be great! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Am Donnerstag, 8. Mai 2008 15:36 schrieb [EMAIL PROTECTED]: Hi I have a bit of a dilemma.I have a list of lists, eg, [[1,2,3],[4,5,6],[7,8,9]]. Imagine they represent a grid with 0-2 on the x axis and 0-2 on the y axis, eg, (0,0) is 1, (1,0) is 2, (2,1) is 6, etc and (2,3) is 9. I want to be able to put in the list of lists, and the (x,y) coordinate, and return the value. Also, I need to be able to replace a value in the list. Eg, if I wanted to replace (2,3) with 100, then the output of the expression would be [[1,2,3],[4,5,6],[7,8,100]]. Any help would be great! To get the value at a position, look up (!!) To replace a value, you could use zipWith ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi MailList Haskell-Cafe: Till now, which module / package / lib can i use to access binary file ? And is this easy to use in GHC ? Regards -- L.Guo 2007-05-24 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
leaveye.guo: Hi MailList Haskell-Cafe: Till now, which module / package / lib can i use to access binary file ? And is this easy to use in GHC ? Data.Binary? Or perhaps just Data.ByteString, available on hackage, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3 or in base. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. Which function could do this work correctly ? -- L.Guo 2007-05-24 - 发件人:Donald Bruce Stewart 发送日期:2007-05-24 14:03:27 收件人:L.Guo 抄送:MailList Haskell-Cafe 主题:Re: [Haskell-cafe] (no subject) leaveye.guo: Hi MailList Haskell-Cafe: Till now, which module / package / lib can i use to access binary file ? And is this easy to use in GHC ? Data.Binary? Or perhaps just Data.ByteString, available on hackage, http://hackage.haskell.org/cgi-bin/hackage-scripts/package/binary-0.3 or in base. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
leaveye.guo: Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. Which function could do this work correctly ? Hmm. Do you have an example? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. Which character is this: ^D or ^Z? Which operating system - Windows, perhaps? And you are reading from a file, not from stdin? -k ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Sorry for not familiar to the email client. My system is WinXP, and using GHC 6.6. And is read from file. Data is truncated at the ^Z char. I just wrote one simple test code. import IO writeTest fn = do h - openFile fn WriteMode mapM_ (\p - hPutChar h (toEnum p::Char)) $ [0..255] ++ [0..255] hClose h accessTest fn = do h - openFile fn ReadMode s - hGetContents h putStrLn . show . map fromEnum $ s hClose h main = do writeTest ttt accessTest ttt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
On Thu, May 24, 2007 at 02:38:05PM +0800, L.Guo wrote: Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. You have to use readBinaryFile instead of readFile. I had the same trouble as well. I finally implemented accessing single characters in C and did use ffi because I didn't know haw to do this i haskell properly. ( using peek/poke functions 4 bytes got written (wihch is annotateted somewhere ) If you are interested I can sent you the modified ByteString package. If someone can tell me which haskell function to use to set a random char in a memory buffer I would be pleased .. Marc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
marco-oweber: On Thu, May 24, 2007 at 02:38:05PM +0800, L.Guo wrote: Thanks for your suggestion, and sorry for the subject. I have read the introduction of Data.ByteString, it is helpful. And also, there is one problem left. When i read a binary file, data is truncated at the charactor EOF. You have to use readBinaryFile instead of readFile. I had the same trouble as well. I finally implemented accessing single characters in C and did use ffi because I didn't know haw to do this i haskell properly. ( using peek/poke functions 4 bytes got written (wihch is annotateted somewhere ) If you are interested I can sent you the modified ByteString package. If someone can tell me which haskell function to use to set a random char in a memory buffer I would be pleased .. 'poke' or else use unboxed Word8 arrays Check the src for Data.ByteString for examples. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
to Ketil : Tring openBinaryFile, I notice that I cannot make one usable buffer, just because I can not find one function to malloc a memory or just get one change-able buffer. :-$ to Marc: I can not locate which module including readBinaryFile. And I use hoogle search engine. Could you give me some more hints ? -- L.Guo 2007-05-24 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
leaveye.guo: to Ketil : Tring openBinaryFile, I notice that I cannot make one usable buffer, just because I can not find one function to malloc a memory or just get one change-able buffer. :-$ No 'malloc' here in Haskell land: that's done automatically. Recall that 'getContents' will read your opened file into a [Char]. (or use Data.ByteString to get a stream of Word8). What are you trying to do? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
To read the handle openBinaryFile returns, both the hGetBuf and hGetBufNonBlocking needs one parameter _buf_ of type Ptr a. I can not get one data of that type. In the doc, there is only nullPtr, and also some type cast functions. I failed to find some other buffer-maker function. What should I do ? -- L.Guo 2007-05-24 - From: Donald Bruce Stewart At: 2007-05-24 17:03:55 Subject: Re: Re: [Haskell-cafe] (no subject) What are you trying to do? -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
leaveye.guo: To read the handle openBinaryFile returns, both the hGetBuf and hGetBufNonBlocking needs one parameter _buf_ of type Ptr a. I can not get one data of that type. In the doc, there is only nullPtr, and also some type cast functions. I failed to find some other buffer-maker function. What should I do ? I mean, what problem are you trying to solve? Ptrs aren't the usual way to manipulate files in Haskell. Here, for example, is a small program to print the first byte of a binary file: import System.IO import qualified Data.ByteString as B main = do h - openBinaryFile a.out ReadMode s - B.hGetContents h print (B.head s) When run: $ ./a.out 127 Note there's no mallocs or pointers involved. -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
On Thu, 2007-05-24 at 17:01 +0800, L.Guo wrote: Tring openBinaryFile, Well, did you get it to work? I can not locate which module including readBinaryFile. This is what I find in System.IO (ghci :b System.IO): openBinaryFile :: FilePath - IOMode - IO Handle openBinaryTempFile :: FilePath - String - IO (FilePath, Handle) hSetBinaryMode :: Handle - Bool - IO () so you have the option of either using openBinaryFile or openFile and using hSetBinaryMode to true. I guess - I've never had to use them. I can't find a readBinaryFile either, but writing one might be a good excercise? Makes me wonder whether one should have binary be the default? I'm a stranger in Windows-land, but are there cases where you want reading of a file to be terminated on ^Z? Seems pretty awful to me. Concerning mutable buffers, it is of course possible, but hardly idiomatic Haskell. Why do you need mutability? -k ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Re: [Haskell-cafe] (no subject)
Very thanks for your example, I have not notice that there is a group of hGetxxx functions in ByteString. In other words, I was using hGetxxx which implemented in IO module. So it always failed. -- L.Guo 2007-05-24 - From: Donald Bruce Stewart At: 2007-05-24 17:31:02 Subject: Re: Re: [Haskell-cafe] (no subject) I mean, what problem are you trying to solve? Ptrs aren't the usual way to manipulate files in Haskell. ... -- Don ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Hello, Ketil Malde wrote: Makes me wonder whether one should have binary be the default? I'm a stranger in Windows-land, but are there cases where you want reading of a file to be terminated on ^Z? Seems pretty awful to me. The ghc docs state about openBinaryFile: Like openFile, but open the file in binary mode. On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLF. [...] text mode treats control-Z as EOF The CRLF-to-LF translation is the more important part. It allows '\n' to stand for the end of a line on windows, too, even if lines are terminated by two characters in windows text files. Tillmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
I'm attempting to construct an abstract data type with a generalised (deferred) representation. For a simple motivating example, say I am building an abstract data type with this representation: newtype Foo1 k e = Foo1 (Data.Map.Map k (Data.Set.Set e)) While this is a fine default representation, I would like to be able to substitute IntMap for Map or IntSet for Set in cases where k or e happen to be Int, or simple list-based map and set implementations for types lacking an Ord instance. Following is a prototype of the approach I've come up with so far. It's been quite an adventure just getting this to type-check (due to lack of experience with MPTCs and FDs), so I'd be grateful for comments on whether it is likely to withstand use in real programs, other ways to solve the problem, etc. {-# LANGUAGE FunctionalDependencies #-} -- Map class, with generic newtype wrapper instance. class MapLike k v m | m - k v where emptyM :: m insertWithM :: (v - v - v) - k - v - m - m toListM :: m - [(k,v)] newtype Map m k v = Map m instance MapLike k v m = MapLike k v (Map m k v) where emptyM = Map emptyM insertWithM f k v (Map m) = Map (insertWithM f k v m) toListM (Map m) = toListM m -- Set class, with generic newtype wrapper instance. class SetLike e s | s - e where singletonS :: e - s unionWithS :: (e - e - e) - s - s - s toListS :: s - [e] newtype Set s e = Set s instance SetLike e s = SetLike e (Set s e) where singletonS e = Set (singletonS e) unionWithS f (Set s1) (Set s2) = Set (unionWithS f s1 s2) toListS (Set s) = toListS s -- Abstract datatype Foo, whose representation is deferred -- through the Map and Set newtype wrappers. newtype Foo m k s e = Foo (Map m k (Set s e)) class FooLike k e s m | m - k s, s - e where emptyF :: m insertWithF :: (e - e - e) - k - e - m - m toListF :: m - [(k,e)] instance (MapLike k (Set s e) m, SetLike e s) = FooLike k e (Set s e) (Foo m k s e) where emptyF = Foo emptyM insertWithF f k e (Foo m) = Foo (insertWithM (unionWithS f) k (singletonS e) m) toListF (Foo m) = [ (k,e) | (k,s) - toListM m, e - toListS s ] Note that the FooLike class is not strictly necessary to the approach, since its methods could be written as top-level functions, but I thought it couldn't hurt. It does have the advantages of consolidating class constraints in one place, making functional dependencies explicit, and supporting further composition using the same technique. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
_ FREE online classifieds from Windows Live Expo buy and sell with people you know http://clk.atdmt.com/MSN/go/msnnkwex001001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Dear Colleagues, Apologies in advance for the p.m. ommission. This is a kind reminder that the deadline for extended abstract submissions to TFP 2007 is tomorrow, Feb. 1 at 11:59 p.m. EST. We are also pleased to announce that the TFP 2007 invited speaker is John McCarthy, Stanford University. For further details, please visit our website at: http://cs.shu.edu/tfp2007/ . The TFP 2007 program committee looks forward to receiving your submissions! Best wishes, Marco Dr. Marco T. Morazan TFP 2007 Program Committee Chair http://cs.shu.edu/tfp2007/___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Dear, I will try to explain what I'm trying to achieve, below you can find the code demonstrating where I'm at currently, and where I would like to ideally get, as well as the current compilation error. Basically I'm working on a minilanguage that I would like to simulate. This language is based on a core concept which can in the example below is Foo. Now there is a 'primitive' instance of Foo that is the list. What I now want to do is make FooF an instance as well. FooF being a record based on a map that contains some other instances of Foo by name as well as code that will use this lookup table. For instance (this is not definite syntax): my pseudoproglanguage: A = [1..10] (aka refer to the 'primitive' instance of Foo) B = [1..10] (aka refer to the 'primitive' instance of Foo) bar C = if dum B then bar A else bar B dum C = dum A dum B I realize I need existentials for this, but I'm afraid that my type-fu is lacking in this area. Perhaps one of you could point me in the right direction. With regards, Christophe {-# OPTIONS_GHC -fglasgow-exts #-} module FooBar where import qualified Data.Map as M class Foo f b | f - b where foo :: f a - b bar :: f a - b - b dum :: f a - b - Bool instance Foo [] Int where foo c = 0 bar c i = i+1 dum c i = (length c == i) data F b a = forall f. Foo f b = F (f a) instance Foo (F b) b where foo (F c) = F . foo $ c bar (F c) i = bar c i dum (F c) i = dum c i data FooF b a = FooF { cols :: M.Map String (F b a), barC :: M.Map String (F b a) - b - b, dumC :: M.Map String (F b a) - b - Bool } instance Foo (FooF b) b where foo c = fmap (foo) c bar c i = barC c (cols c) i dum c i = dumC c (cols c) i makeFooF cols barC dumC = FooF {cols = cols, barC = barC, dumC = dumC} -- Example: -- makeFooF -- [(A, [1..10]), (B, [1..8])] -- (\t - if dum (M.lookup A t) -- then bar (M.lookup B t) -- else bar (M.lookup A t) -- (\t - dum (M.lookup A t) dum (M.lookup B t) -- Ideally this system would also allow to make some FooF that is based on another FooF, hence the reason for existentials -- FooBar.hs:19:16: -- Couldn't match the rigid variable `b' against `F b1 a' -- `b' is bound by the instance declaration at FooBar.hs:18:0 -- Expected type: b -- Inferred type: F b1 a -- In the _expression_: (F . foo) $ c -- In the definition of `foo': foo (F c) = (F . foo) $ c FooBar.hs:31:12: -- Couldn't match the rigid variable `b' against `f b1' -- `b' is bound by the instance declaration at FooBar.hs:30:0 -- Expected type: b -- Inferred type: f b1 -- In the application `fmap (foo) c' -- In the definition of `foo': foo c = fmap (foo) c -- Failed, modules loaded: none. --- --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-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi Im having a small problem with the portability of my Haskell code. My code uses wxHaskell and the library for which this one is the Haskell interface (that is called wxWidgets) doesnt work in the same away in Windows and Linux. Now I now which code run in Linux and in Windows but I dont want to have to manually change the file in each platform. I tried a solution using the C pre-processor but I getting in trouble. I use code like: #ifdef __WIN32__ (Windows code) #else (Linux code) #endif I also add the --cpp to the ghc and it works for me in Linux but give me linking errors in Windows. Does someone have any hints on how to have different code in Windows and Linux? I would be thankful in some help. Best regards Miguel Vilaça ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
Hello José, Wednesday, March 15, 2006, 5:54:49 PM, you wrote: JMV #ifdef __WIN32__ i use the following: #if defined(mingw32_HOST_OS) || defined(__MINGW32__) || defined(_MSC_VER) -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
L.S., I used the link checker of the World Wide Web Consortium to check the links on haskell.org; there are several links broken. As the checks take a long time, I have put the results on my website: http://members.chello.nl/hjgtuyl/computing/Haskell/checklinks/checklink.htm The check is a recursive check with depth 3, starting from the home page; this will probably not cover all of the website. To repeat this check, go to: http://validator.w3.org/checklink -- Best wishes for the new year, Henk-Jan van Tuyl -- http://members.chello.nl/hjgtuyl -- Using Opera's revolutionary e-mail client: https://secure.bmtmicro.com/opera/buy-opera.html?AID=789433 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
Hi, I have to install HDirect on a windows plataform but I have a lot of problems. When I try to install the version 0.21,make boot has problems with Happy and I've commented this line(the path is correct),latter make lib give 2 errors: ../src/ihc :command not found [hugs/PointerPrim.hs] Error I don't know if this version is for windows too,the 0.16 isn't available in the page.I do the installation with cygwin I don't know if it's the best opcion.Please I need use HDirect,help me. Thanks for all, Bea This message was sent using IMP, the Internet Messaging Program. ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] (no subject)
From: John Peterson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Functional Reactive Programming Functional Reactive Programming is alive but in need of some new students to push the effort a bit. A lot of us have taken teaching or industrial positions so the old FRP team is a bit depleted. I don't think anyone is working on Yampa directly at the moment. Although it's stable and working well it lacks a critical mass of nice libraries to make it attractive. I'm still plugging on a wxHaskell port to Yampa (the wxFruit stuff). I've made some semantic changes to Yampa so I probably shouldn't say it's real Yampa but pretty close. I should have something to release later this fall. Aside from that, we have a student working in the hybrid modeling area. That's good stuff but not likely to produce software of interest to Joe Haskell. Another student is keeping the robotics side of things alive but it's in the context of a very specialized robotic hardware environment. So there you go! John ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (no subject)
To add briefly to what John wrote, there is a webpage for Yampa: www.haskell.org/yampa which includes all of our publications on FRP/Yampa as well as a decent release of our latest implementation of Yampa (based on arrows). The release has ample examples of how to use Yampa for graphics, animation, and basic control systems such as used in robotics. Also, although most of the developers have dispersed, I believe that most of them are still interested in the ideas, and the [EMAIL PROTECTED] mailing list would probably be responsive if anyone bothered to use it. -Paul Hudak John C. Peterson wrote: From: John Peterson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Functional Reactive Programming Functional Reactive Programming is alive but in need of some new students to push the effort a bit. A lot of us have taken teaching or industrial positions so the old FRP team is a bit depleted. I don't think anyone is working on Yampa directly at the moment. Although it's stable and working well it lacks a critical mass of nice libraries to make it attractive. I'm still plugging on a wxHaskell port to Yampa (the wxFruit stuff). I've made some semantic changes to Yampa so I probably shouldn't say it's real Yampa but pretty close. I should have something to release later this fall. Aside from that, we have a student working in the hybrid modeling area. That's good stuff but not likely to produce software of interest to Joe Haskell. Another student is keeping the robotics side of things alive but it's in the context of a very specialized robotic hardware environment. So there you go! John ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe -- Professor Paul Hudak Chair, Dept of Computer Science Office: (203) 432-1235 Yale University FAX:(203) 432-0593 P.O. Box 208285 email: [EMAIL PROTECTED] New Haven, CT 06520-8285 WWW:www.cs.yale.edu/~hudak ___ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe