Re: [Haskell-cafe] manipulating predicate formulae
I have no idea if it is relevant, but I wrote a tiny proof assistant for a hilbert style first order logic the other day. http://repetae.net/Hilbert.hs set hasUnicode to False at the top if your terminal doesn't support unicode. fun what one can do in a few hundred lines of haskell.. :) heres the cheat sheet: stack operations 0 duplicate top of lemma stack 1-9 move the specified formula to the top of the stack shift A-Z copy the specified formula from the theorem list to the top of the stack - delete top of lemma stack p promote the top of the lemma stack to a theorem rules of inference d (degeneralize) replace a quantifier with an unbound term g (generalize) universally quantify all unbound terms m use modus pones to apply the top of the stack to the second item in the stack utilities h show this help u undo last operation ! quit John -- John Meacham - ⑆repetae.net⑆john⑈ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] manipulating predicate formulae
Hi Ganesh, manipulating predicate formulae was a central part of my PhD research. I implemented some normalization and standarcization functions in Haskell - inspired by term rewriting (like normalization to Boolean ring representation) as well as (as far as I know) novell ideas (standardization of quantified formulae w.r.t associativity and commutativity). If you are interested in that stuff I am pleased to provide you with more information. May be you can describe in more detail what you are looking for. Best, Immanuel 2008/11/30 Ganesh Sittampalam [EMAIL PROTECTED] Hi, Are there any Haskell libraries around for manipulating predicate formulae? I had a look on hackage but couldn't spot anything. I am generating complex expressions that I'd like some programmatic help in simplifying. Cheers, Ganesh ___ 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] ANN: Real World Haskell, now shipping
An even more painless way to do it is to edit the .cabal file (or just cabal on Windows) in the cabal user directory (somwhere under the AppData folder on windows), to have default values for extra-include-dirs and extra-lib-dirs. Then you don't need to enter them explicitly every time you use cabal. /Tobias -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judah Jacobson Sent: den 4 december 2008 01:07 To: Andrew Coppin Cc: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] ANN: Real World Haskell, now shipping On Wed, Dec 3, 2008 at 11:53 AM, Andrew Coppin [EMAIL PROTECTED] wrote: Brandon S. Allbery KF8NH wrote: On 2008 Dec 2, at 14:44, Andrew Coppin wrote: Regardless, it has been my general experience that almost everything obtained from Hackage fails miserably to compile under Windows. (IIRC, one package even used a Bash script as part of the build process!) I haven't seen similar problems on Linux. (But I don't use Linux very often.) About the worst problem there was Gtk2hs being confused about some Autoconfig stuff or something... Many packages assume you have the msys / mingw stuff installed on Windows (if they work at all; those of us who don't develop on Windows wouldn't really know how to go about being compatible). According to the Cabal experts, the issue is that Windows doesn't have a standard place for keeping header files like the various POSIX environments typically do. That means anything that binds an external C library (i.e., almost all useful Haskell packages) don't easily work on Windows. I'm not sure what the solution to this is... Have you tried passing the --extra-include-dirs and --extra-lib-dirs arguments to 'cabal install'? On OS X, that's how I deal with the macports package manager which puts all library files under /opt/local. I've found the process pretty painless. -Judah ___ 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] Re: ANNOUNCE: gitit 0.2 release - wiki using HAppS, git, pandoc
Conal suggested to allow markdown/pandoc as the highlighting format for Haddock, I liked the idea, but many didn't. I guess the only workable solution would be to extend haddock to allow using an external plugin to parse the actual formatting, stripping out leading markers and somehow dealing with Haddock link markup. 2008/12/4 Anatoly Yakovenko [EMAIL PROTECTED]: Being practical, this is very close to the markdownish literate haskell you are suggesting. hugo yea, i agree. But is there any way to generalize this to non haskell projects? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Push the envelope. Watch it bend. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Gluing pipes
On Wed, Dec 3, 2008 at 10:17 AM, Matt Hellige [EMAIL PROTECTED] wrote: From time to time, I've wanted to have a more pleasant way of writing point-free compositions of curried functions. I'd like to be able to write something like: \ x y - f (g x) (h y) This particular composition of f with g and h is an example of composition in what mathematicians call an operad. I think operads glue things just how you want. Unfortunately (1) I don't think mathematicians have great notation for it either and (2) it's hard to combine operads with currying because they rely on having a well defined notion of the number of arguments of a function. -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Building plugins from Hackage
Hello List, when I try to install the package plugins with cabal i get the following error. cabal: dependencies conflict: ghc-6.8.3 requires Cabal ==1.2.4.0 however Cabal-1.2.4.0 was excluded because plugins-1.3.1 requires Cabal ==1.4.* Is there a way to resolve this? Any ideas? Sol. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: haskell-src-exts 0.4.4
Fellow Haskelleers, it is my pleasure to announce the new release of the haskell-src-exts package, version 0.4.4: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/haskell-src-exts-0.4.4 darcs get http://code.haskell.org/HSP/haskell-src-exts The new feature in this release is support for pragmas. haskell-src-exts-0.4.4 supports all pragmas supported by GHC, with the exception of option-level pragmas (LANGUAGE, OPTIONS_GHC etc) that appear before the module header. The reason these are not yet supported is simply time, there's no real difficulty involved in supporting them too and I will surely get there eventually. 0.4.4 is backwards incompatible with 0.4.3 for two constructors: * The Module constructor (:: Module) now has an extra argument of type 'Maybe WarningText', used for deprecated modules. * The ImportDecl constructor (:: ImportDecl) now has an extra argument of type Bool, stating whether the SOURCE pragma has been used for the import. The full list of pragmas supported by 0.4.4 is: SOURCE, RULES, DEPRECATED, WARNING, INLINE, NOINLINE, SPECIALISE, CORE, SCC, GENERATED and UNPACK. Cheers and Happy Haskelling, /Niklas ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Gluing pipes
On Thu, Dec 4, 2008 at 11:19 AM, Dan Piponi [EMAIL PROTECTED] wrote: On Wed, Dec 3, 2008 at 10:17 AM, Matt Hellige [EMAIL PROTECTED] wrote: From time to time, I've wanted to have a more pleasant way of writing point-free compositions of curried functions. I'd like to be able to write something like: \ x y - f (g x) (h y) This particular composition of f with g and h is an example of composition in what mathematicians call an operad. I think operads glue things just how you want. Unfortunately (1) I don't think mathematicians have great notation for it either and (2) it's hard to combine operads with currying because they rely on having a well defined notion of the number of arguments of a function. Yes, of course I should have mentioned operads! I've thought of operads in connection with this puzzle before (and I seem to remember a recent post from you on the subject), but this time around, it slipped my mind... Thanks for the reminder! Something like operadic composition for curried functions is exactly what I want to define, and I agree that your (1) and (2) are exactly the sticking points. I'm relatively happy with what I've come up with so far, but I do still wonder if it's possible to do better. An alternative approach would be to define an Operad type class, and attempt to coax curried functions into and out of an instance as needed. I hesitate to propose that it's impossible, but I guess it would take type class hacking beyond my abilities in any case. We could imagine being able to write something like: f [g, h] and I think this is the route you took in your blog post? But of course your way only works for uncurried functions, right? And there's a bit of boilerplate? I also believe that this approach would leave at least some arity checking to runtime, which I would consider a shortcoming. Perhaps it would be possible to overcome this with length-indexed lists? Finally, there's a further disadvantage to both of these approaches: it seems to me that neither approach allows us to cross pipes. For instance, we can't define flip using these techniques, or any deep flip: \ x y z - f x z y Is it true in general that operads cannot express pipe-crossing compositions? Or is it just a shortcoming of this particular implementation? Of course this is getting farther afield, and I don't believe that my approach can express this either. Anyway I'd still love to know the answers the questions in my last email, as well as the new questions posed in this one. ;) Thanks for taking the time! Matt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Gluing pipes
I'd like to be able to write something like: \ x y - f (g x) (h y) I don't think mathematicians have great notation for it either Well, there is Combinatory Logic. http://www.haskell.org/haskellwiki/Combinatory_logic J.W. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Gluing pipes
On Thu, Dec 4, 2008 at 12:07 PM, Matt Hellige [EMAIL PROTECTED] wrote: Finally, there's a further disadvantage to both of these approaches: it seems to me that neither approach allows us to cross pipes. For instance, we can't define flip using these techniques, or any deep flip: \ x y z - f x z y Is it true in general that operads cannot express pipe-crossing compositions? Or is it just a shortcoming of this particular implementation? Of course this is getting farther afield, and I don't believe that my approach can express this either. This is not exactly true. It's possible in my scheme to express a deep flip, as long as it's the last thing you want to do: \ f x y z - f x z y == id ~ flip It's not clear to me whether your operad class can express this (or whether operads in general can express this), or whether my scheme can express more general permutations of arguments. Matt ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Gluing pipes
On Thu, Dec 4, 2008 at 10:21 AM, Matt Hellige [EMAIL PROTECTED] wrote: \ f x y z - f x z y == id ~ flip It's not clear to me whether your operad class can express this (or whether operads in general can express this) There exists an operad that can (at the cost of even more notation), but you're right that the specific operad that I implemented can't. Actually, if you look at the papers, mathematicians do have a perfectly good notation for this, and it'd be cool if there were a programming language that supported it well: drawing diagrams! Johannes Waldmann said: Well, there is Combinatory Logic. But it's not known for its ease of use :-) -- Dan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: ANNOUNCE: haskell-src-exts 0.4.4
Niklas Broberg wrote: Fellow Haskelleers, it is my pleasure to announce the new release of the haskell-src-exts package, version 0.4.4: The full list of pragmas supported by 0.4.4 is: SOURCE, RULES, DEPRECATED, WARNING, INLINE, NOINLINE, SPECIALISE, CORE, SCC, GENERATED and UNPACK. Ah, excellent. The hprotoc program generates possibly mutually recursive modules and when it does these need fixing up by hand to add SOURCE pragmas and boot files. I could use your new package to automatically break the recursion. Interesting. Thanks, Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Animated line art
So, the muse has taken me. I'm going to attempt to produce some animated mathematical drawings involving lines and curves. Gtk2hs has a Cairo binding that should make rendering the stuff fairly straight-forward. So no problems there. Now, what I *could* do is write a new Haskell program for each drawing I want, hard-coding in the necessary imperative loops for updating coordinates, looping over multiple lines, etc. But that wasn't be very Haskell, would it? ;-) It seems that the correct course of action is to design a DSL for declaratively describing animated line art. Does anybody have ideas about what such a thing might look like? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Animated line art
Andrew Coppin wrote: It seems that the correct course of action is to design a DSL for declaratively describing animated line art. Does anybody have ideas about what such a thing might look like? You could take a look at Fran [1] and Yampa [2] which both seem to do animations in Haskell. [1] http://conal.net/Fran/ [2] http://www.haskell.org/yampa/ Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] manipulating predicate formulae
Hi, That sounds like it might be quite useful. What I'm doing is generating some predicates that involve addition/subtraction/comparison of integers and concatenation/comparison of lists of some abstract thing, and then trying to simplify them. An example would be simplifying \exists p_before . \exists p_after . \exists q_before . \exists q_after . \exists as . \exists bs . \exists cs . (length p_before == p_pos length q_before == q_pos (p_before == as q_after == cs) p_before ++ p_new ++ p_after == as ++ p_new ++ bs ++ q_old ++ cs as ++ p_new ++ bs ++ q_old ++ cs == q_before ++ q_old ++ q_after) into q_pos - (p_pos + length p_new) = 0 which uses some properties of length as well as some arithmetic. I don't expect this all to be done magically for me, but I'd like as much help as possible - at the moment I've been growing my own library of predicate transformations but it's all a bit ad-hoc. If I could look at your code I'd be very interested. Cheers, Ganesh On Thu, 4 Dec 2008, Immanuel Normann wrote: Hi Ganesh, manipulating predicate formulae was a central part of my PhD research. I implemented some normalization and standarcization functions in Haskell - inspired by term rewriting (like normalization to Boolean ring representation) as well as (as far as I know) novell ideas (standardization of quantified formulae w.r.t associativity and commutativity). If you are interested in that stuff I am pleased to provide you with more information. May be you can describe in more detail what you are looking for. Best, Immanuel 2008/11/30 Ganesh Sittampalam [EMAIL PROTECTED] Hi, Are there any Haskell libraries around for manipulating predicate formulae? I had a look on hackage but couldn't spot anything. I am generating complex expressions that I'd like some programmatic help in simplifying. Cheers, Ganesh ___ 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] How to define Show [MyType] ?
I am trying to define instance Show[MyType] so show (x:xs :: MyType) would return a single string where substrings corresponding to list elements will be separated by \n. This would allow pretty printing of MyType list in several lines instead of one, as default Show does for lists. For example: data ShipInfo = Ship { name :: String, kind :: String, canons :: Int } deriving Show s1 = Ship {name =HMS Fly, kind = sloop, canons=16} s2 = Ship {name =HMS Surprise, kind = frigate, canons=42} -- Yet when I try to define: instance (Show ShipInfo) = Show [ShipInfo] where show (x:xs) = ++ show x ++ ++ show xs -- I get this error: Illegal instance declaration for `Show [ShipInfo]' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) In the instance declaration for `Show [ShipInfo]' Failed, modules loaded: none. -- On the other hand this definition: instance (Show a) = Show [a] where show (x:xs) = ++ show x ++ ++ show xs -- Gives a different error: Duplicate instance declarations: instance (Show a) = Show [a] -- Defined at C:/wks/haskell-wks/ShowMatrix.hs:37:0 instance (Show a) = Show [a] -- Defined in GHC.Show Failed, modules loaded: none. -- Note the last error implicitly tells us that defining Show [a] is possible in principle! -- In fact it already defined in GHC.Show !!! -- How to define Show [MyType] ? Thanks! Dmitri ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to define Show [MyType] ?
Dmitri O.Kondratiev wrote: -- How to define Show [MyType] ? Define instance Show MyType and implement not only show (for 1 value of MyType) but also showList, which Show provides as well. You can do all the magic in there. HTH, Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to define Show [MyType] ?
On Fri, 2008-12-05 at 01:27 +0300, Dmitri O.Kondratiev wrote: I am trying to define instance Show[MyType] so show (x:xs :: MyType) would return a single string where substrings corresponding to list elements will be separated by \n. This would allow pretty printing of MyType list in several lines instead of one, as default Show does for lists. For example: data ShipInfo = Ship { name :: String, kind :: String, canons :: Int } deriving Show s1 = Ship {name =HMS Fly, kind = sloop, canons=16} s2 = Ship {name =HMS Surprise, kind = frigate, canons=42} -- Yet when I try to define: instance (Show ShipInfo) = Show [ShipInfo] where show (x:xs) = ++ show x ++ ++ show xs The context on this is borked: you already know Show ShipInfo, so you don't need to assume it here. -- I get this error: Illegal instance declaration for `Show [ShipInfo]' (The instance type must be of form (T a b c) where T is not a synonym, and a,b,c are distinct type variables) Read this error again. Your instance is for the type `[] ShipInfo', which does not have the form GHC listed for you. The instance in GHC.Show (don't import it from there! Import it from Prelude, instead) is for a type of the form `[] a', which does have that form. Now, in this case, you don't need to define Show ([ShipInfo]), because the instance for Show [a] already does what you want; you just need to define an explicit instance for Show ShipInfo and over-ride the showList method. If you really, really wanted to define Show [ShipInfo], then putting {-# LANGUAGE FlexibleInstances, OverlappingInstances #-} at the beginning of your file would work. At the cost of using overlapping instances, of course. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to define Show [MyType] ?
If you really, really wanted to define Show [ShipInfo], then putting {-# LANGUAGE FlexibleInstances, OverlappingInstances #-} at the beginning of your file would work. At the cost of using overlapping instances, of course. And at the cost of causing code like this: f :: Show a = [a] - String f xs = show xs to fail to compile (see Incoherent Instances). Implement showList; it's the Right Answer for this case. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to define Show [MyType] ?
On Thu, 2008-12-04 at 14:46 -0800, Ryan Ingram wrote: If you really, really wanted to define Show [ShipInfo], then putting {-# LANGUAGE FlexibleInstances, OverlappingInstances #-} at the beginning of your file would work. At the cost of using overlapping instances, of course. And at the cost of causing code like this: f :: Show a = [a] - String f xs = show xs to fail to compile (see Incoherent Instances). Right. Implement showList; it's the Right Answer for this case. Yeah. jcc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] two type-level programming questions
1) Type families, associated types, synonyms... can anything replace the use of TypeCast for explicit instance selection? Section 2, bullet 4 of http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap indicates a negative response. Any other ideas? 2) Any progress/options for kind polymorphism in instances? Thanks for your time. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] two type-level programming questions
Sort of. I believe you can use type equality constraints to replace the use of TypeCast; that is, in any code that looks like: instance TypeCast a HTrue = ... you can write instance (a ~ HTrue) = ... (at least, it has worked for me that way) This at least makes me feel a bit more monadic (warm fuzzy!) than the indecipherable magic that is the declaration of TypeCast/TypeCast'/TypeCast'' -- ryan On Thu, Dec 4, 2008 at 3:09 PM, Nicolas Frisby [EMAIL PROTECTED] wrote: 1) Type families, associated types, synonyms... can anything replace the use of TypeCast for explicit instance selection? Section 2, bullet 4 of http://www.haskell.org/haskellwiki/GHC/AdvancedOverlap indicates a negative response. Any other ideas? 2) Any progress/options for kind polymorphism in instances? Thanks for your time. ___ 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] detecting socket closure in haskell
This is a haskell + networking question... I have a multi threaded haskell server, which accepts client connections, processes their requests, and returns results. It currently works as desired, except where a client drops a connection whilst the server is processing a request. In this circumstance, the server currently doesn't notice that the client has gone until it finishes the processing and attempt to read the next request. I'd like to change it so that the request is aborted as soon as the client disconnects. One way of doing this would would be to maintain a separate thread that is always reading from the client, and buffers until the main thread needs the information. Whilst this would detect the remote close, it also would potentially consume large amounts of memory to maintain this buffer. Hence I seem to need a means of detecting that a socket has been closed remotely, without actually reading from it. . Does anyone know how to do this? One reference I've found is this: http://stefan.buettcher.org/cs/conn_closed.html Apparently recv() with appropriate flags can detect this - though I'm not convinced that the code as shown on that page doesn't busy wait when there is unread data from the client. Any tips or pointers? Perhaps what I'm trying to do is not currently possible in haskell, without using the FFI (which would be ok). Or perhaps it's not possible in linux at all. Thanks, Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
RE: [Haskell-cafe] Animated line art
It seems that the correct course of action is to design a DSL for declaratively describing animated line art. Does anybody have ideas about what such a thing might look like? Someone else already mentioned FRAN and it's ilk. But perhaps you don't need something that fancy. If you implement your drawing logic as a function from time to the appropriate render actions, ie | import qualified Graphics.Rendering.Cairo as C | | type Animation = Time - C.Render () then you just need to call this function multiple times to generate sucessive frames. Tim ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] class method name scope
What proposals are out there to address the issue of scoping class methods? I always feel I must be careful, when exposing a class definition that I want clients to be able to extend, that I mustn't step on the namespace with semantically appropriate but overly general names (e.g. 'run'). It'd be nice if class method names were module scoped and could be qualified. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] detecting socket closure in haskell
Tim Docker wrote: One way of doing this would would be to maintain a separate thread that is always reading from the client, and buffers until the main thread needs the information. Whilst this would detect the remote close, it also would potentially consume large amounts of memory to maintain this buffer. I think flushing a lost connection causes an error. So instead of buffering its incoming data, you could try flushing the handle and see if that causes an error, which you can then catch. No idea if that will work, but it's worth a try. Martijn. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] class method name scope
I have never run into such an issue. Typically classes tend to have the smallest possible basis of methods. I would consider a class with more than about 10 or 15 methods (including superclasses' methods) to indicate poor design. That is just a rough heuristic. But you're right, it would be nice if name qualification applied to classes as well, so that we wouldn't have to worry about it at all. On Thu, Dec 4, 2008 at 4:53 PM, Jason Dusek [EMAIL PROTECTED] wrote: What proposals are out there to address the issue of scoping class methods? I always feel I must be careful, when exposing a class definition that I want clients to be able to extend, that I mustn't step on the namespace with semantically appropriate but overly general names (e.g. 'run'). It'd be nice if class method names were module scoped and could be qualified. -- _jsn ___ 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] class method name scope
It's not that I like to have a lot of methods in a class, but rather a lot of classes. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Animated line art
Andrew, I can think of several reasons why simple time-indexed animation may be a bad idea. Some important aspects of animation are usually: 1) A main use case is playback, where time change is continuous and monotonic. 2) Differential action is often much cheaper than time jumping (i.e. between adjacent time steps most lines do not move and do not need to be recomputed. It is cheaper to modify the previous animation.) 3) Time is a topological space, with lots of nice properties: change of time is a group, intervals are decomposable, etc. Animation inherits this structure as a G-torsor (e.g. between two close enough times the line art should look very similar, there is no canonical start time). You are throwing this all away if you just treat line art like a point set. 4) Although your Time set may be discrete, you may want to pretend it is smooth to facilitate e.g. motion blur and simulation, which strongly favor a differential approach. There is often a need for run-up or adaptive time interval subdivision. Clip start and stop times are often changed interactively. Instead of defining a calculus (line art indexed by time), you may want to define an algebra (action of time change on line art). You can manipulate the algebra independently for efficiency (e.g. combine adjacent time intervals into one big interval if pointwise evaluation is cheap, or subdivide an interval if differential change is cheap) and then apply the final result to line art defined at some time origin. Take a quick read of http://en.wikipedia.org/wiki/Principal_bundle where the (group) G is time change and the (fiber bundle) P is the line art. At minimum, implement your time argument as a start time + delta time, and consider a State monad (or StateT monad transformer) to hold future optimizations like cached (time,art) pairs in case you change your mind. Dan Tim Docker wrote: It seems that the correct course of action is to design a DSL for declaratively describing animated line art. Does anybody have ideas about what such a thing might look like? Someone else already mentioned FRAN and it's ilk. But perhaps you don't need something that fancy. If you implement your drawing logic as a function from time to the appropriate render actions, ie | import qualified Graphics.Rendering.Cairo as C | | type Animation = Time - C.Render () then you just need to call this function multiple times to generate sucessive frames. Tim ___ 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] class method name scope
No deep inheritance? Then what's the problem? module X where class Foo a where foo :: a - String module Y where class Foo' a where foo :: a - String module Main where import qualified X import qualified Y instance X.Foo Int where foo _ = X instance Y.Foo' Int where foo _ = Y It is known that the first foo is referring to X.foo, and the second is referring to Y.foo. In fact... come to think of it, there are actually no namespace problems. The instance syntax is just a little quirky, since you don't qualify the LHS, even if the name is only imported qualified. Or is that not what you're referring to? Luke On Thu, Dec 4, 2008 at 5:43 PM, Jason Dusek [EMAIL PROTECTED] wrote: It's not that I like to have a lot of methods in a class, but rather a lot of classes. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] detecting socket closure in haskell
Quoth Tim Docker [EMAIL PROTECTED]: | Hence I seem to need a means of detecting that a socket has been closed | remotely, without actually reading from it. . Does anyone know how to do | this? One reference I've found is this: | | http://stefan.buettcher.org/cs/conn_closed.html | | Apparently recv() with appropriate flags can detect this - though I'm | not convinced that the code as shown on that page doesn't busy wait when | there is unread data from the client. Right - poll() will still find data there, after the peek, so you'll be running that loop as fast as you can make the 2 system calls, and what I think might be worse, it should keep reading the same 32 bytes at the head of the buffer ... and never notice the connection close. Well, I haven't tried it, but this solution doesn't make sense to me. | Any tips or pointers? Perhaps what I'm trying to do is not currently | possible in haskell, without using the FFI (which would be ok). Or | perhaps it's not possible in linux at all. I don't know of a way to do it in C. I think it's very likely that the kernel finds out only after all the data has been delivered through the network interface, so by the time you can even in principle know that the connection closed, all the data will either have been processed by the client or reside in memory somewhere on the computer. I guess you might try your buffering thread, and if you're really worried about undue amounts of buffered data, set some maximum size, where you either stop trying to notice end-of-file, or switch to another storage medium (e.g., disk file.) Donn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] class method name scope
Oh! Then there is no problem, after all. -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] manipulating predicate formulae
Hi, you can browse my code here.http://trac.informatik.uni-bremen.de:8080/hets/browser/trunk/Search/CommonIt has become part of Hets http://www.dfki.de/sks/hets the Heterogeneous Tool Set which is a parsing, static analysis and proof management tool combining various tools for different specification languages. However, let me warn you: the code isn't yet well documented at parts also ad hoc. Don't know whether it can help to solve your tasks. The goal of my normalization code is to bring formulae via equivalence transformations and alpha-renaming into a standard or normal form such that for instance the following three formulae become syntactically identical (i.e. not just modulo alpha equivalence or modulo associativity and commutativity): \begin{enumeratenumeric} \item $\forall \varepsilon . \varepsilon 0 \Rightarrow \exists \delta . \forall x. \forall y. 0 |x - y| \wedge |x - y| \delta \Rightarrow | f (x) - f (y) | \varepsilon$ \item $\forall \varepsilon . \exists \delta . \forall x, y. \varepsilon 0 \Rightarrow (0 |x - y| \wedge |x - y| \delta \Rightarrow | f (x) - f (y) | \varepsilon)$ \item $\forall e . \exists d . \forall a,b. e 0 \wedge |a - b| d \wedge 0 |a - b| \Rightarrow | f (a) - f (b) | e$ \end{enumeratenumeric} Cheers, Immanuel 2008/12/4 Ganesh Sittampalam [EMAIL PROTECTED] Hi, That sounds like it might be quite useful. What I'm doing is generating some predicates that involve addition/subtraction/comparison of integers and concatenation/comparison of lists of some abstract thing, and then trying to simplify them. An example would be simplifying \exists p_before . \exists p_after . \exists q_before . \exists q_after . \exists as . \exists bs . \exists cs . (length p_before == p_pos length q_before == q_pos (p_before == as q_after == cs) p_before ++ p_new ++ p_after == as ++ p_new ++ bs ++ q_old ++ cs as ++ p_new ++ bs ++ q_old ++ cs == q_before ++ q_old ++ q_after) into q_pos - (p_pos + length p_new) = 0 which uses some properties of length as well as some arithmetic. I don't expect this all to be done magically for me, but I'd like as much help as possible - at the moment I've been growing my own library of predicate transformations but it's all a bit ad-hoc. If I could look at your code I'd be very interested. Cheers, Ganesh On Thu, 4 Dec 2008, Immanuel Normann wrote: Hi Ganesh, manipulating predicate formulae was a central part of my PhD research. I implemented some normalization and standarcization functions in Haskell - inspired by term rewriting (like normalization to Boolean ring representation) as well as (as far as I know) novell ideas (standardization of quantified formulae w.r.t associativity and commutativity). If you are interested in that stuff I am pleased to provide you with more information. May be you can describe in more detail what you are looking for. Best, Immanuel 2008/11/30 Ganesh Sittampalam [EMAIL PROTECTED] Hi, Are there any Haskell libraries around for manipulating predicate formulae? I had a look on hackage but couldn't spot anything. I am generating complex expressions that I'd like some programmatic help in simplifying. Cheers, Ganesh ___ 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] Animated line art
On 05/12/2008, at 10:46 AM, Tim Docker wrote: Someone else already mentioned FRAN and it's ilk. But perhaps you don't need something that fancy. If you implement your drawing logic as a function from time to the appropriate render actions, ie | import qualified Graphics.Rendering.Cairo as C | | type Animation = Time - C.Render () then you just need to call this function multiple times to generate sucessive frames. The ANUPlot graphics library I wrote does exactly this. The darcs repo is at http://code.haskell.org/ANUPlot/ANUPlot-HEAD/ It comes with lots of examples that do the sort of things you describe. Ben. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] two type-level programming questions
More monadic? -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Finall Call For Papers (DSL WC)
*** IFIP Working Conference on Domain Specific Languages (DSL WC) *** July 15-17, 2009, Oxford http://www.hope.cs.rice.edu/twiki/bin/view/WG211/DSLWC * Call for Papers Domain-specific languages are emerging as a fundamental component of software engineering practice. DSLs are often introduced when new domains such as web-scripting or markup come into existence, but it is also common to see DSLs being introduced and adopted for traditional domains such as parsing and data description. Developing software using DSLs has many benefits. DSLs are often designed based on existing notations that are already in use by experts in a given domain. As such, successful DSLs often reduce or eliminate the effort needed to transform the concept or innovation produced by the domain expert into an executable artifact or even a deliverable software product. DSL implementations can capture and mechanize a significant portion of the repetitive and mechanical tasks that a domain expert traditionally needed to perform in order to produce an executable. DSLs can in many cases capture and make widely available special expertise that only top specialists in a given domain might have. By capturing expert knowledge and reducing repetitive tasks, DSLs often also lead to software that is significantly more portable, more reliable and more understandable than it would otherwise be. DSLs can be viewed as having a dual role to general-purpose languages: whereas general purpose languages try to do everything as well as possible, DSLs are designed to find a domain where they can solve some class of problems -- no matter how small -- in the best possible way. Widely known examples of DSLs include Matlab, Verilog, SQL, LINQ, JavaScript, PERL, HTML, Open GL, Tcl/Tk, Macromedia Director, Mathematica/Maple, AutoLisp/AutoCAD, XSLT, RPM, Make, lex/yacc, LaTeX, PostScript, Excel, among many others. But while these tools have been widely successful, they still fall short of realizing the full idea behind them. The goal of this conference is to explore the extent to which incorporating modern principles of language design and software engineering can benefit existing and future domain-specific languages. The ultimate goal of using DSLs is to improve programmer productivity and software quality. Often, this is achieved by reducing the cost of initial software development as well as maintenance costs. These improvements - programs being easier to write and maintain - materialize as a result of domain-specific guarantees, analyses, testing techniques, verification techniques, and optimizations. * Paper Criteria Papers are sought addressing the research problems, fundamental principles, and practical techniques of DSLs, including but not limited to: - Foundations, including semantics, formal methods, type theory, and complexity theory - Language design, ranging from concrete syntax to semantic and typing issues - Software engineering, including domain analysis, software design, and round-trip engineering - Software processes, including metrics for software and language evaluation - Implementation techniques, including parsing, compiling, and program generation - Program analysis and automated transformation - Reverse engineering, re-engineering, design discovery, automated refactoring - Hardware/software codesign - Programming environments, including visual languages, debuggers, and testing infrastructure - Teaching DSLs and the use of DSLs in teaching Case studies, including engineering, bioinformatics, hardware specification languages, parallel computing languages, real-time and embedded systems, and networked and distributed domains Papers will be judged on the depth of their insight and the extent to which they translate specific experience into general lessons for domain-specific language designers and implementers, and software engineers. Papers can range from the practical to the theoretical; where appropriate, they should refer to actual languages, tools, and techniques, provide pointers to full definitions and implementations, and include empirical data on results. * Important Dates - July 23rd, 2008: First Call for Papers - November 12th, 2008: Final Call for Papers - December 14th, 2008: Abstract submission due. - December 21st, 2008: Paper submission deadline. - February 23rd, 2009: Author notification of decisions - March 22nd, 2009: Camera ready manuscripts due * Instructions for Authors Proceedings will be published in the Springer LNCS series. Submissions and final manuscripts are to follow the LNCS stylesheet formatting guidelines, and are not to exceed 25 pages. Please submit your manuscripts online using the EasyChair conference management system. * Program Committee Jon Bentley,
[Haskell-cafe] Could FDs help usurp an ATs syntactic restriction?
From the error below, I'm inferring that the RHS of the associated type definition can only contain type variables from the instance head, not the instance context. I didn't explicitly see this restriction when reading the GHC/Type_families entry. Could perhaps the a b - bn functional dependency of the TypeEq class lift this restriction for bn? This isn't my ball park, but that idea has my hopes up :). haskell {-# LANGUAGE TypeFamilies #-} import TypeEq -- Attempting to encapsulate TypeEq behind an associated type. class EQ a b where type BN a b instance TypeEq a b bn = EQ a b where type BN a b = bn /haskell results in an error ghci /tmp/Test.hs:9:16: Not in scope: type variable `bn' Failed, modules loaded: none. /ghci ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Hat cannot use with ghc 6.10?
Hi, I want to do some tracing, and I thought hat could help. Well hmake and hat both could not been made with ghc 6.10 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] propogation of Error
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi. i have a partial library for parsing ogg files here: http://hpaste.org/12705 i have a question about an aspect of the code. in the function checkHeader there are a sequence of functions to check various elements in the header of a ogg file. if i test this function against a file that *isn't* an ogg file, i.e. badFile = /home/user/.bashrc :: String main = parseOgg badFile = (\x - print x) i would expect to get back the Error from the *first* function in the sequence of functions in checkHeader (oggHeaderError from the oggHeader function). but instead i always see the Error from the *last* function in the sequence, OggPacketFlagError from the OggPacketFlag function. why is this? is there any way i can get the desired behavior...i.e. see the Error from the first function in the sequence that fails? thanks brad -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkk4tQYACgkQxRg3RkRK91PD9gCePloWFIvE9WjcfApxR2RmnHQ0 pUgAn0WAzRQR/y2yE8yeYP1s7eKHyKDh =EcOM -END PGP SIGNATURE- ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fun with type functions
2008/11/27 Simon Peyton-Jones [EMAIL PROTECTED]: can you tell us about the most persuasive, fun application you've encountered, for type families or functional dependencies? Hi, I certainly had fun with the Instant Insanity puzzle, in Monad.Reader issue 8: http://www.haskell.org/haskellwiki/User:ConradParker/InstantInsanity That was using functional dependencies. Then Pepe Iborra pasted a version of Instant Insanity with type families: http://hpaste.org/2689 Looking back at this, Manuel left the following comment: -- There is unfortunately, no simple way to print the normalised type. -- In fact, GHC goes to great length to show types with as little -- normalisation as possible to users. (Especially for error messages, -- that usually makes them much easier to understand.) However, with -- type families, I think we really ought to have a ghci command to -- specifically request a normalised type. I'll put that on my -- TODO list! -- For the moment, you can of course try forcing normalisation by -- triggering type errors; eg -- :t solution :: Int (Does ghci now have a command for printing normalised types?) There are also links to haskell-cafe discussion and some other implementations (in C++ templates and D) to, um, compare: http://www.haskell.org/haskellwiki/User_talk:ConradParker/InstantInsanity cheers, Conrad. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] manipulating predicate formulae
Thanks - I'll take a look. One pre-emptive question: if I want to use it, it'd be more convenient, though not insurmountable, if that code was BSD3-licenced, since it will fit in better with the licence for camp http://projects.haskell.org/camp, which I might eventually want to integrate my code into. (the predicates I described are intended to be the commutation conditions for patches). Is that likely to be possible? Cheers, Ganesh On Fri, 5 Dec 2008, Immanuel Normann wrote: Hi, you can browse my code here.http://trac.informatik.uni-bremen.de:8080/hets/browser/trunk/Search/CommonIt has become part of Hets http://www.dfki.de/sks/hets the Heterogeneous Tool Set which is a parsing, static analysis and proof management tool combining various tools for different specification languages. However, let me warn you: the code isn't yet well documented at parts also ad hoc. Don't know whether it can help to solve your tasks. The goal of my normalization code is to bring formulae via equivalence transformations and alpha-renaming into a standard or normal form such that for instance the following three formulae become syntactically identical (i.e. not just modulo alpha equivalence or modulo associativity and commutativity): \begin{enumeratenumeric} \item $\forall \varepsilon . \varepsilon 0 \Rightarrow \exists \delta . \forall x. \forall y. 0 |x - y| \wedge |x - y| \delta \Rightarrow | f (x) - f (y) | \varepsilon$ \item $\forall \varepsilon . \exists \delta . \forall x, y. \varepsilon 0 \Rightarrow (0 |x - y| \wedge |x - y| \delta \Rightarrow | f (x) - f (y) | \varepsilon)$ \item $\forall e . \exists d . \forall a,b. e 0 \wedge |a - b| d \wedge 0 |a - b| \Rightarrow | f (a) - f (b) | e$ \end{enumeratenumeric} Cheers, Immanuel 2008/12/4 Ganesh Sittampalam [EMAIL PROTECTED] Hi, That sounds like it might be quite useful. What I'm doing is generating some predicates that involve addition/subtraction/comparison of integers and concatenation/comparison of lists of some abstract thing, and then trying to simplify them. An example would be simplifying \exists p_before . \exists p_after . \exists q_before . \exists q_after . \exists as . \exists bs . \exists cs . (length p_before == p_pos length q_before == q_pos (p_before == as q_after == cs) p_before ++ p_new ++ p_after == as ++ p_new ++ bs ++ q_old ++ cs as ++ p_new ++ bs ++ q_old ++ cs == q_before ++ q_old ++ q_after) into q_pos - (p_pos + length p_new) = 0 which uses some properties of length as well as some arithmetic. I don't expect this all to be done magically for me, but I'd like as much help as possible - at the moment I've been growing my own library of predicate transformations but it's all a bit ad-hoc. If I could look at your code I'd be very interested. Cheers, Ganesh On Thu, 4 Dec 2008, Immanuel Normann wrote: Hi Ganesh, manipulating predicate formulae was a central part of my PhD research. I implemented some normalization and standarcization functions in Haskell - inspired by term rewriting (like normalization to Boolean ring representation) as well as (as far as I know) novell ideas (standardization of quantified formulae w.r.t associativity and commutativity). If you are interested in that stuff I am pleased to provide you with more information. May be you can describe in more detail what you are looking for. Best, Immanuel 2008/11/30 Ganesh Sittampalam [EMAIL PROTECTED] Hi, Are there any Haskell libraries around for manipulating predicate formulae? I had a look on hackage but couldn't spot anything. I am generating complex expressions that I'd like some programmatic help in simplifying. Cheers, Ganesh ___ 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] two type-level programming questions
See slide 40 of Weaing the Hair Shirt: A Retrospective on Haskell, Simon Peyton-Jones, POPL 2003 http://research.microsoft.com/Users/simonpj/papers/haskell-retrospective/index.htm -- ryan On Thu, Dec 4, 2008 at 7:04 PM, Jason Dusek [EMAIL PROTECTED] wrote: More monadic? -- _jsn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe