Re: [Haskell-cafe] [Haskell] ANNOUNCE: haskell-src-exts 1.14.0
On Tue, Aug 20, 2013 at 11:19 AM, Niklas Broberg wrote: On Tue, Aug 20, 2013 at 10:48 AM, Niklas Hambüchen wrote: 2) Have you considered downloading the all-of-Hackage tarball and running haskell-src-exts over it to get a benchmark of how much HSE can already parse of the Haskell code out there? Considered, yes. Done, no. Would love to see the results :-). The crew at OdHac (Roman, Erik, Simon) ensured that the current version handles all of 'base', which is a good start. See: Nikolaos Bezirgiannis, Johan Jeuring and Sean Leather. Usage of Generic Programming on Hackage - Experience Report. WGP 2013. http://www.cs.uu.nl/research/techreps/repo/CS-2013/2013-014.pdf http://hackage.haskell.org/package/gpah Unfortunately, it seems we don't mention which version of haskell-src-exts is used for the article. But I'm certain it's 1.13.*, probably 1.13.5. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Monadic parser vs. combinator parser
On Wed, Jan 30, 2013 at 1:21 PM, Jan Stolarek wrote: I will be writing a parser in Haskell and I wonder how to approach the problem. Utrecht University has a course that covers this, among other things. You might find the slides and lecture notes useful: http://www.cs.uu.nl/wiki/TC/CourseMaterials Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] monoid pair of monoids?
On Fri, Dec 21, 2012 at 9:27 AM, Christopher Howard wrote: Thank you for your help. An additional question, if I might: For the sake of elegance and simplicity, I modified the class and instances to avoid the tuple aspect: data Socket2 a b = Socket2 a b instance (Monoid a, Monoid b) = Monoid (Socket2 a b) where Of course, I thought it would be likely I would want other classes and instances with additional numbers of types: data Socket3 a b c = Socket3 a b c instance (Monoid a, Monoid b, Monoid c) = Monoid (Socket3 a b c) where data Socket4 a b c d = Socket4 a b c d instance (Monoid a, Monoid b, Monoid c, Monoid d) = Monoid (Socket4 a b data Socket 5 a b c d e... et cetera Seeing as the pattern here is so rigid and obvious, I was wondering: is it possible to abstract this even more? So I could, for instance, just specify that I want a Socket with 8 types, and poof, it would be there? Or is this as meta as we get? (I.e., without going to something like Template Haskell.) This perhaps isn't the answer you were looking for, but just in case you weren't aware, there are already Monoid instances for tuples up to 5. You can see this at: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-Monoid.html#g:1 Another possibility is a generic monoid class (using generic-deriving): {-# LANGUAGE TypeOperators #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} import GHC.Generics class GMonoid' f where gempty' :: f x gappend' :: f x - f x - f x instance GMonoid' U1 where gempty' = U1 gappend' U1 U1 = U1 instance GMonoid a = GMonoid' (K1 i a) where gempty' = K1 gempty gappend' (K1 x) (K1 y) = K1 (x `gappend` y) instance GMonoid' f = GMonoid' (M1 i c f) where gempty' = M1 gempty' gappend' (M1 x) (M1 y) = M1 (x `gappend'` y) instance (GMonoid' f, GMonoid' h) = GMonoid' (f :*: h) where gempty' = gempty' :*: gempty' gappend' (x1 :*: y1) (x2 :*: y2) = gappend' x1 x2 :*: gappend' y1 y2 class GMonoid a where gempty :: a gappend :: a - a - a default gempty :: (Generic a, GMonoid' (Rep a)) = a gempty = to gempty' default gappend :: (Generic a, GMonoid' (Rep a)) = a - a - a gappend x y = to (gappend' (from x) (from y)) instance (GMonoid b, GMonoid c) = GMonoid (b,c) -- ... Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] AST Rewriting
On Wed, Nov 21, 2012 at 2:56 PM, Emil Axelsson wrote: This is one of the problem Syntactic aims to solve, but it requires you to use a different representation of expressions (for good or bad). If you want to keep your existing representation, then you have to use a generic programming library that supports GADTs. I know at least the Spine approach supports GADTs, but the library on Hackage seems too incomplete to be useful: http://hackage.haskell.org/**package/spinehttp://hackage.haskell.org/package/spine Just a comment on this library (since I put it up there). Yes, it is incomplete. It's only been used for students in a course. It is not intended for practical use. Even if it were complete, the Type datatype is closed, meaning the library cannot be extended to support new types, which probably won't necessarily be that useful to you. The spine view works nicely as a model of SYB but not so nicely as a library for generic programming. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] need help with understanding expression
Hi Daryoush, Prelude :t 3 2 3 2 :: (Num a, Num (a - t)) = t What does the type mean in plain english? It's important to remember that numeric literals are polymorphic. That is, 3 :: Num a = a. They do not have monomorphic types such as Int or Integer. In the above, GHCi is inferring the principal type of 3 applied to 2. Since 3 is in the position of function application, it should have a function type, e.g. a - t. And 2 is the argument to 3, so it has the type 'a'. But there must be Num constraints on these types, and that's what the context (Num a, Num (a - t)) is telling you. Num (a - t) is a strange constraint but so is applying 3 to 2. Whenever you see a Num constraint on a function type, it probably means you're doing something wrong. You might find the (brief) description of typing numeric literals in the language definition helpful: http://www.haskell.org/onlinereport/haskell2010/haskellch6.html#x13-1360006.4.1 Also, in response to your initial query... I am having hard time understanding how removing the outer parenthesis in (max.(+1)) 2 2 to max.(+1) 2 2 Keep in mind the precedence of the function composition operator (.) here: Prelude :i (.) (.) :: (b - c) - (a - b) - a - c -- Defined in GHC.Base infixr 9 . Function application is infixl 10, so even though max . (+1) :: (Num b, Ord b) = b - b - b, when you do max . (+1) 2, the application of (+1) to 2 binds more tightly than (.). A common idiom for removing parentheses with a sequence of compositions is to use ($): Prelude :i ($) ($) :: (a - b) - a - b -- Defined in GHC.Base infixr 0 $ Note that it has the lowest possible precedence. So, you often see the composition of functions as f . g . h $ arg. But this doesn't work well for (curried) functions with 2 arguments. So, in your case, I'd guess the parentheses is simplest idiomatic solution. Though, I think I'd prefer max (succ 2) 2. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Transforming a ADT to a GADT
On Fri, Sep 14, 2012 at 12:45 PM, Florian Lorenzen wrote: I'd like to transform a value of an ADT to a GADT. Suppose I have the simple expression language data Exp = Lit Int | Succ Exp | IsZero Exp | If Exp Exp Exp and the GADT data Term t where TLit :: Int - Term Int TSucc :: Term Int - Term Int TIsZero :: Term Int - Term Bool TIf :: Term Bool - Term ty - Term ty - Term ty that encodes the typing rules. Now, I'd like to have a function typecheck :: Exp - Maybe (Term t) typecheck exp = ... that returns the GADT value corresponding to `exp' if `exp' is type correct. It's not pretty, but it should still be safe... import Control.Applicative import Unsafe.Coerce tcInt :: Exp - Maybe (Term Int) tcInt (Lit i) = pure (TLit i) tcInt (Succ e) = TSucc $ tcInt e tcInt (If c e1 e2) = TIf $ tcBool c * tcInt e1 * tcInt e2 tcInt _ = empty tcBool :: Exp - Maybe (Term Bool) tcBool (IsZero e) = TIsZero $ tcInt e tcBool (If c e1 e2) = TIf $ tcBool c * tcBool e1 * tcBool e2 tcBool _= empty typecheck :: Exp - Maybe (Term t) typecheck e = forget $ tcInt e | forget $ tcBool e where forget :: Term a - Term b forget = unsafeCoerce Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Transforming a ADT to a GADT
On Fri, Sep 14, 2012 at 2:27 PM, Erik Hesselink wrote: I don't think this is safe. What will happen if you evaluate typecheck (Lit 1) :: Maybe (Term Bool) Indeed! Silly me. Caught by the lure again. Thanks. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type variable in class instance
On Tue, Sep 11, 2012 at 3:39 PM, Corentin Dupontwrote: @Oleg: Yes the set of events is closed and I would be much happier with a GADT! But no matter how hard I tried I couldn't manage. Here is the full problem: *{-# LANGUAGE ExistentialQuantification, TypeFamilies, DeriveDataTypeable #-} import Data.Typeable -- | Define the events and their related data class (Eq e, Typeable e, Show e) = Event e where data EventData e -- | Groups of events data PlayerEvent = Arrive | Leave deriving (Typeable, Show, Eq) -- | events types data Player = Player PlayerEvent deriving (Typeable, Show, Eq) data Message m = Message String deriving (Typeable, Show, Eq) -- | event instances instance Event Player where data EventData Player = PlayerData {playerData :: Int} instance (Typeable m) = Event (Message m) where data EventData (Message m) = MessageData {messageData :: m} -- | structure to store an event data EventHandler = forall e . (Event e) = EH {eventNumber :: Int, event :: e, handler :: (EventData e) - IO ()} deriving Typeable -- store a new event with its handler in the list addEvent :: (Event e) = e - (EventData e - IO ()) - [EventHandler] - [EventHandler] addEvent event handler ehs = undefined -- trigger all the corresponding events in the list, passing the **data to the handlers triggerEvent :: (Event e) = e - (EventData e) - [EventHandler] - IO () triggerEvent event edata ehs = undefined --Examples: msg :: Message Int msg = Message give me a number myList = addEvent msg (\(MessageData n) - putStrLn $ Your number is: ++ show n) [] trigger = triggerEvent msg (MessageData 1) **myList --Yelds Your number is: 1* Has you can see this allows me to associate an arbitrary data type to each event with the type family EventData. Furthermore some events like Message let the user choose the data type using the type parameter. This way I have nice signatures for the functions addEvent and triggerEvent. The right types for the handlers and the data passed is enforced at compilation time. But I couldn't find any way to convert this into a GATD and get rid of the Event class.. Would this work? data Player = Arrive | Leave data Message m = Message String data Data a where PlayerData :: Int - Data Player MessageData :: m - Data (Message m) data Handler where Handler :: Int - e - (Data e - IO ()) - Handler addEvent :: e - (Data e - IO ()) - [Handler] - [Handler] addEvent = undefined triggerEvent :: e - Data e - [Handler] - IO () triggerEvent = undefined Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type variable in class instance
On Tue, Sep 11, 2012 at 6:46 PM, David Menendez wrote: Mixing GADTs and Typeable seems like a bad idea. If you really don't want to put viewEvent in the Event typeclass, but the class of events is closed, you could use a GADT to witness the event type. On Tue, Sep 11, 2012 at 7:03 PM, Corentin Dupont wrote: unfortunately it seems that I will be obliged to maintain 2 parallel structures: for each Event instance, I will have to add a ViewEvent element as well carrying the same information: That's why I like the all-GADT solution... Inspired by David's suggestion, here's another version without Typeable. In Corentin's version, the switching back and forth between explicit and forgetful typing bothered me. This version never forgets types. Also, viewEvent is really an instance of Show, as I would expect. I don't see the extra maintenance burden mentioned by Corentin. {-# LANGUAGE TypeFamilies, GADTs #-} data Player = Arrive | Leave deriving Show newtype Message t = Message String deriving (Eq, Show) data Type :: * - * where Int:: Type (Message Int) String :: Type (Message String) Player :: Type Player data TEq :: * - * - * where Refl :: TEq a a teq :: Type a - Type b - Maybe (TEq a b) teq IntInt= Just Refl teq String String = Just Refl teq Player Player = Just Refl teq _ _ = Nothing type family Data t :: * type instance Data (Message t) = t type instance Data Player = Int data Event t = Event (Type t) t data Handler where Handler :: Event t - (Data t - IO ()) - Handler runHandler :: Eq t = Event t - Data t - Handler - IO () runHandler (Event t e) d (Handler (Event u e') f) = case teq t u of Just Refl | e == e' - f d _ - return () runHandlers :: Eq t = Event t - Data t - [Handler] - IO () runHandlers e d hs = mapM_ (runHandler e d) hs -- Replacement for viewEvent instance Show (Event t) where show (Event ty e) = case ty of Int- show e ++ of type Int String - show e ++ of type String Player - Player ++ show e messageEvent :: Type (Message t) - String - Event (Message t) messageEvent t s = Event t (Message s) playerEvent :: Player - Event Player playerEvent = Event Player -- Tests event1 = messageEvent Int give me a number -- No type signature necessary! handler1 = Handler event1 (\n - putStrLn $ Your number is: ++ show n) test1= runHandlers event1 1 [handler1] -- Yields Your number is: 1 Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] type variable in class instance
On Tue, Sep 11, 2012 at 9:18 PM, Corentin Dupont wrote: That's very interesting. One problem is, if the set of event is closed, the set of possible data types is not (the user can choose any data type for a Message callback for example). I think this can be solved using a class instead of a GADT for Type. One can also use a type witness? Just a bit more complicated... {-# LANGUAGE TypeFamilies, GADTs #-} import Data.Typeable import Unsafe.Coerce data Player = Arrive | Leave deriving Show newtype Message t = Message String deriving (Eq, Show) data Type :: * - * where MessageT :: Typeable t = Proxy t - Type (Message t) PlayerT :: Type Player data Proxy t typeOfProxy :: Typeable t = Proxy t - TypeRep typeOfProxy x = typeOf (unproxy x) where unproxy :: Proxy t - t unproxy = undefined data TEq :: * - * - * where Refl :: TEq a a teq :: Type a - Type b - Maybe (TEq a b) teq (MessageT p) (MessageT q) | typeOfProxy p == typeOfProxy q = Just (unsafeCoerce Refl) teq PlayerT PlayerT= Just Refl teq __ = Nothing type family Data t :: * type instance Data (Message t) = t type instance Data Player = Int data Event t = Event (Type t) t data Handler where Handler :: Event t - (Data t - IO ()) - Handler runHandler :: Eq t = Event t - Data t - Handler - IO () runHandler (Event t e) d (Handler (Event u e') f) = case teq t u of Just Refl | e == e' - f d _ - return () runHandlers :: Eq t = Event t - Data t - [Handler] - IO () runHandlers e d hs = mapM_ (runHandler e d) hs -- Replacement for viewEvent instance Show (Event t) where show (Event ty e) = case ty of MessageT t - show e ++ of type ++ show (typeOfProxy t) PlayerT- Player ++ show e messageEvent :: Typeable t = Proxy t - String - Event (Message t) messageEvent t s = Event (MessageT t) (Message s) playerEvent :: Player - Event Player playerEvent = Event PlayerT -- Tests int :: Proxy Int int = undefined event1 = messageEvent int give me a number -- No type signature necessary! handler1 = Handler event1 (\n - putStrLn $ Your number is: ++ show n) test1= runHandlers event1 1 [handler1] -- Yields Your number is: 1 The Proxy type is not absolutely necessary, because you can use the type directly. But I think the Proxy makes it clear that no (non-bottom) terms of the type are expected. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] salvia
On Tue, Aug 21, 2012 at 5:02 PM, Sergey Mironov wrote: Hi. Does anybody know anything about Sebastiaan Visser, the maintainer of Salvia-* packages (web server) ? Looks like his email is dead. I responded to Sergey off-list, so others don't have to. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [***SPAM***] Parallel Haskell Digest 11
Hi Eric (et Café), On Thu, Jul 5, 2012 at 5:13 PM, Eric Kow wrote: *[Everybody should write everything in Go?][m7] (28 May) Ryan Hayes posted a small [snippet of Go][go-snippet] showing how friendly he found it for writing concurrent programs, “No pthread... not stupid crap... just works!”. The program seems to create 4 threads which print out 1 to 100 each. What do Haskellers think? See the comments for some discussion between Haskell people like Simon Marlow, and some folks in the Go community about our respective approaches to the problem. [go-snippet]: https://gist.github.com/3010649 [m7]: https://plus.google.com/app/plus/mp/588/#~loop:view=activityaid=z13pwzbajpqeg3qmo23hgporhlywe1fd5 https://plus.google.com/app/plus/mp/588/#~loop:view=activityaid=z13pwzbajpqeg3qmo23hgporhlywe1fd5 [m8 The [m7] link didn't work for me, but the following appears to be the referenced thread: https://plus.google.com/10955911385859313/posts/FAmNTExSLtz Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [***SPAM***] Parallel Haskell Digest 11
On Fri, Jul 6, 2012 at 4:03 PM, Eric Kow wrote: Subject line makes me wonder how often the digests get caught in people's spam filters Oops! Should have removed that part before replying. I think it comes from the university's mail server, and it's rather obnoxious. I tend to ignore it. Since you're curious, I can tell you that two out of the eleven issues (9 was the other one) were tagged as spam. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Introducing FP Complete
On Wed, Jun 6, 2012 at 3:22 AM, Bartosz Milewski wrote: You might have seen a few post by me mentioning FP Complete and asked yourself the question: Who is this guy and what is FP Complete? Yes. ;) I haven't been active in the Haskell community, as I'm a relative newcomer to Haskell. I am better known in the C++ community where I've been promoting functional-style programming and the use of Haskell for modelling difficult aspects of template metaprogramming. Great! We can always use more people to bridge the divide, so to speak. It was therefore natural for me to join a newly founded company, FP Complete, whose goal is to commercialize Haskell. I believe that now is the right time for Haskell to become a strong software industry player, especially that functional programming is being widely recognized as the answer to the recent multicore and GPU explosion. Also great! We need more companies to see the light and start building better software. I should mention that the support from the part of the Haskell community that we have so far contacted has been overwhelmingly positive. We have Simon P-J's blessing, we are in close collaboration with Well Typed, we have friends at Galois, Parallel Scientific, Amgen, and many other Haskell shops. Hopefully you will hear from and about us more often in the future. Looking forward to it. Welcome! Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Announce: Haskell Platform 2012.2.0.0
On Sun, Jun 3, 2012 at 6:24 PM, Mark Lentczner wrote: We're pleased to announce the next release of Haskell Platform: a single, standard Haskell distribution for everyone. Awesome! Congratulations! Download Haskell Platform 2012.2.0.0: http://haskell.org/platform/ It's a relatively minor thing, but I noticed that the above URL redirects to http://hackage.haskell.org/platform// which is incidentally considered a different URL from http://hackage.haskell.org/platform/ by Google's +1 service. Perhaps not surprisingly, http://haskell.org/platform redirects to the latter, single-/ Hackage URL. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Program for displaying graph state in lambda interpreter?
Hi Benjamin, On Fri, Jun 1, 2012 at 9:54 PM, Benjamin Redelings wrote: I have written an interpreter that operates on the lambda calculus augmented with letrec, constructors, case, primitive objects, and builtin operations. I'd like to display the internal state of the intepreter at various points so that I can, um, debug the programs that I've written. Currently I've got about 3500 nodes, and I'm dumping a graph that I format using the 'dot' program in graphviz. [...] However, it would be nice to know of any programs that are better suited for this. For example, if I could write * and draw arrows from the placeholders to the memory location being referenced, that would be easier to read. This is done here http://en.wikibooks.org/wiki/** Haskell/Graph_reductionhttp://en.wikibooks.org/wiki/Haskell/Graph_reductionto illustrate that 'square (1+2)' doesn't evaluate 1+2 twice. Any ideas? This may not answer your question, but it might be related and/or helpful: http://rochel.info/#graph-rewriting Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confused by ghci output
On Thu, May 31, 2012 at 6:35 PM, Clark Gaebel wrote: *X 3^40 `mod` 3 == modexp2 3 40 3 False *X modexp2 3 40 3 0 *X 3^40 `mod` 3 0 *X 3^40 `mod` 3 :: Int 1 *X 3^40 `mod` 3 :: Integer 0 I'm confused. Last I checked, 0 == 0. Yes, but 3^40 /= 3^40 when you have arithmetic overflow: *X 3^40 :: Int 689956897 *X 3^40 :: Integer 12157665459056928801 Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Zipper and Comonad
Hi Mathijs, On Tue, May 22, 2012 at 8:42 AM, Mathijs Kwik wrote: After using zippers for a while, I wanted to dig a bit deeper into them. I found there is some relation between Zipper and Comonad, but this confuses me somewhat. You might also take a look at: Comonadic functional attribute evaluation Tarmo Uustalu, Varmo Vene Trends in Functional Programming 6 (2007), pp. 145-162 http://www.cs.ioc.ee/~tarmo/papers/tfp05.pdf Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] (+1) vs let inc=(+1)
On Tue, May 22, 2012 at 9:34 PM, Artyom Kazak wrote: http://www.haskell.org/**haskellwiki/Monomorphism_**restrictionhttp://www.haskell.org/haskellwiki/Monomorphism_restriction + http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Arithmetic expressions with GADTs: parsing
Hi Romildo, On Wed, May 2, 2012 at 3:08 PM, j.romildo wrote: You are right in the sense that I cannot mix Expr Bool and Expr Double in a (O op l r) expression. But the parser should be able to parse any form of expressions. So I rewrite my program to take this into account. The new versions still does not compile: Expr.hs:27:23: Couldn't match expected type `Double' with actual type `Bool' Expected type: ParsecT String () Data.Functor.Identity.Identity (Expr Double) Actual type: ParsecT String () Data.Functor.Identity.Identity (Expr Bool) In the first argument of `(|)', namely `pBool' In the second argument of `(|)', namely `pBool | pEqual' You appear to still be having the same problem. Perhaps this because you don't quite understand the type error? Let me help you dissect it. Since this is a type error, I'm not going to assume anything about what should or should not work. I'll only look at the types. First, let's comment out the offending line, so that your file type-checks: Line 27: -- pExpr = pArit | pBool | pEqual Next, let's look at each of the components relevant to the type error. The first mentioned is (|). In GHCi, we can find out more information about that: *Expr :i (|) (|) :: ParsecT s u m a - ParsecT s u m a - ParsecT s u m a -- Defined in Text.Parsec.Prim infixr 1 | From this, we see that the same type parameters to ParsecT are used in the two argument types as well as the result type. We also see that (|) is a right-associative infix operator. So, this means the offending line could be parenthesized as pArit | (pBool | pEqual), which fits the second part of the type error, pBool | pEqual. Looking at the types of those, we see: *Expr :t pBool pBool :: ParsecT String () Data.Functor.Identity.Identity (Expr Bool) *Expr :t pEqual pEqual :: ParsecT String () Data.Functor.Identity.Identity (Expr Double) As we saw with the type of (|), these two types should be the same (as in unifiable). However, they are not, because the two type arguments to the Expr GADT differ: Bool in one case and Double in the other. GHC cannot match (unify) these types. Now, to the goal of your project: You say that the parser should be able to parse any form of expressions, but since you are using a GADT with the expected expression types in the result index of each constructor, you can only define parsers that each parse an expression of a single type. That is, you can have a parser for Expr Bool and a parser for Expr Double, but these parsers can not be alternatives of another Expr and still have a valid type. This is, of course, the reason for using the type index as it is: you don't want Bool where you expect Double and vice versa. As a general comment, you may want to consider simplifying your goal to parsing only expressions of type Double. Then, what happens to your Bool constructors? Well, you could drop them, or you could extend your GADT with an if constructor that takes a boolean condition with Double alternatives. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] DHD = UHac: Register by April 1 for the DHD
DHD = UHac will be held from Friday, April 20, to Sunday, April 22, 2012. The Dutch HUG Day (DHD) is on the first day. The Utrecht Hackathon (UHac) follows the DHD on Friday and continues through the weekend. http://www.haskell.org/haskellwiki/DHD_UHac *Please register for the DHD by Sunday, April 1.* Our sponsor for the DHD, Ordina, will use the registration to prepare the (free!) lunch and venue. If you're coming only to UHac and not the DHD, you can register by April 19. http://www.haskell.org/haskellwiki/DHD_UHac/Register See you in Utrecht! The Organizers: Sean Leather Jurriën Stutterheim Jurriaan Hage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Adding type annotations to an AST?
Hi Stephen, On Mon, Mar 5, 2012 at 08:52, Stephen Tetley wrote: How do I add type annotations to interior locations in an abstract syntax tree? I use an annotated expression tree in my work. The nodes of the AST are annotated with the type, assumption set, and constraint set as described in constraint-based type inference [1]. We have a paper describing our type-and-transform system [2] and a link in the paper points to the code. Let me know if you have any questions. Regards, Sean [1] http://www.staff.science.uu.nl/~heere112/phdthesis/index.html [2] http://www.cs.uu.nl/research/techreps/UU-CS-2012-004.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: join (UHac $ DHD)
You can still join us at the DHD = UHac, but the time is running out. http://www.haskell.org/haskellwiki/DHD_UHac Deadline: April 1 (no fooling!) We've also have a few updates: * We put the DHD program up, at least as much of it as we have. http://www.haskell.org/haskellwiki/DHD_UHac/DHD_Program * As you can see from the program, there is still room for more speakers. In particular, we'd like to hear from people coming outside Utrecht and the Netherlands. We'd also like to see more lightning talks. Send Sean an email with your idea: leat...@cs.uu.nl * UHac on Friday has moved to a new location. Actually, it's the same location as on Saturday and Sunday, so that should make things easier. See you in Utrecht! The Organizers: Sean Leather Jurriën Stutterheim Jurriaan Hage P.S. Make sure your Monad is also a Functor. P.P.S. Apologies for multiple copies. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Nico de Bruijn dies at 93
More: http://translate.google.com/translate?sl=nltl=enu=http%3A%2F%2Fweb.tue.nl%2Fcursor%2Finternet%2Fjaargang54%2Fcursor11%2Fnieuws%2Findex.php%3Fpage%3Dx34 Background: http://en.wikipedia.org/wiki/Nicolaas_Govert_de_Bruijn ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: Registration open for DHD = UHac, April 20 - 22, Utrecht
We are happy to open registration to all. If you're interested in checking out some neat talks or hacking on cool Haskell projects, reserve your spot today! http://www.haskell.org/haskellwiki/DHD_UHac We are still looking for speakers for the Dutch HUG Day. Please consider sharing your latest new project or toy. It doesn't have to be research. It doesn't even have to be done. Just email Sean Leather (leat...@cs.uu.nl) with your idea, and we'll talk about it. Also, the wiki has been updated with a lot more information since that last announcement. We'll continue to add more. Let us know if you have any questions. = = = = =DHD = UHac = = = = April 20 - 22 = = = = Utrecht = = = = = Sean Leather and Jurriën Stutterheim Organizers ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Switching GHC Version
Hi Yusaku, On Tue, Feb 7, 2012 at 00:27, HASHIMOTO, Yusaku wrote: Hi, I wrote a simple shell function for switching GHC version on the system. It works only under Mac OSX, and only switch GHCs installed via .pkg installers. It's useful to experiment newer features without worrying breaking environment. GHC_BASE_DIR=/Library/Frameworks/GHC.framework/Versions/ ghcs () { VERSION=$1 sudo $GHC_BASE_DIR/$VERSION/Tools/create-links . /Library/Frameworks / } I have something quite similar, though mine depends on just one symbolic link, Current. See the end of this email. This approach also works with GHC installed from source. I use the following script to run 'configure' in the GHC source: $ cat configure.mine VERSION=7.4.1 ./configure \ --prefix=/Library/Frameworks/GHC.framework/Versions/$VERSION/usr \ --with-gmp-libraries=/Library/Frameworks/GMP.framework\ --with-gmp-includes=/Library/Frameworks/GMP.framework/Headers For me, the 'ghc-ver' script is useful since I'm often just want to quickly play with something in one version of GHC and not create a development environment. Other tools and approaches that have already been mentioned are also useful. Regards, Sean $ cat ~/bin/ghc-ver #!/bin/sh ECHO=/bin/echo PROGNAME=`basename $0` if [ -z $1 ]; then $ECHO Usage: $PROGNAME version $ECHO$PROGNAME list exit 1 fi VERSIONS_DIR=/Library/Frameworks/GHC.framework/Versions if [ $1 = list ]; then /usr/bin/find $VERSIONS_DIR -type d -depth 1 | xargs basename exit 0 fi CHOSEN_DIR=$VERSIONS_DIR/$1 $ECHO -n Checking for $CHOSEN_DIR ... if [ -d $CHOSEN_DIR ]; then rm $VERSIONS_DIR/Current ln -sf $CHOSEN_DIR $VERSIONS_DIR/Current $ECHO Success! else $ECHO Not found! fi ghc --version $ ls -l /usr/bin/ghc # as well as ghci, ghc-pkg, etc. lrwxr-xr-x [...] /usr/bin/ghc - /Library/Frameworks/GHC.framework/Versions/Current/usr/bin/ghc ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskellers in Delhi, India
On Tue, Jan 24, 2012 at 10:21, Anupam Jain wrote: Are there any haskellers in Delhi or nearby areas interested in a meetup? I've been dabbling in Haskell for a long time I'm not in India, but I am curious about the use of Haskell or other FP languages for teaching/research there. Do you (or does anyone else) happen to know which schools have courses that teach/use FP/Haskell? Thanks, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Not an isomorphism, but what to call it?
On Thu, Jan 19, 2012 at 23:21, Dan Doel wrote: A is a retract of B. http://nlab.mathforge.org/nlab/show/retract g is the section, f is the rectraction. You seem to have it already. The definition needn't be biased toward one of the functions. Great! That's what I was looking for. Thanks! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Not an isomorphism, but what to call it?
I have two types A and B, and I want to express that the composition of two functions f :: B - A and g :: A - B gives me the identity idA = f . g :: A - A. I don't need g . f :: B - B to be the identity on B, so I want a weaker statement than isomorphism. I understand that: (1) If I look at it from the perspective of f, then g is the right inverse or section (or split monomorphism). (2) If I look at from g, then f is the left inverse or retraction (or split epimorphism). But I just want two functions that give me an identity on one of the two types and I don't care which function's perspective I'm looking at it from. Is there a word for that? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Where is the pairing-with-monoid monad instance?
On Wed, Jan 11, 2012 at 03:23, Conal Elliott wrote: Is the standard pair-with-monoid monad instance in some standard place? I see the Applicative instance in Control.Applicative, and the pair-with-monoid Functor instance in Control.Monad.Instances, and the (-) e and Either e monad instances also in Control.Monad.Instances. I'm looking for something like instance Monoid o = Monad ((,) o) where return a= (mempty,a) (o,a) = f = (o `mappend` o', b) where (o',b) = f a Where is it hiding from me? http://hackage.haskell.org/packages/archive/transformers/0.2.2.0/doc/html/Control-Monad-Trans-Writer-Lazy.html#t:WriterT? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] ANNOUNCE: DHD = UHac, April 20 - 22, Utrecht
Calling all Haskellers! To open 2012 and in celebration of the group's 3rd year of existence, the Dutch Haskell Users Group is happy to announce a new event that combines an informal conference and a hackathon. = = = = =*DHD = UHac* = = = = *April 20 - 22* = = = = *Utrecht* = = = = = = DHD = The Dutch HUG Day, or DHD, will be a half day of talks on anything Haskell-y or FP-ish. It will be held on Friday, April 20. = UHac = The Utrecht Hackathon, or UHac, will be a gathering of the community of enthusiastic Haskell hackers from around the world. It will start immediately following the DHD and continue to Sunday, April 22. = Call for Speakers = We are looking for speakers for the Dutch HUG Day. If you have something interesting to share, please email Sean Leather (leat...@cs.uu.nl). See the website for more. = Website = For more information that will be continuously updated, see the event wiki page: *http://www.haskell.org/haskellwiki/DHD_UHac* Join us for a Haskell-y time in the Netherlands. We look forward to seeing you there! Sean Leather and Jurriën Stutterheim Organizers ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Type checker for haskell-src-exts (was: Typechecking Using GHC API)
On Thu, Dec 15, 2011 at 11:07, Niklas Broberg wrote: Envisioned: The function you ask for can definitely be written for haskell-src-exts, which I know you are currently using. I just need to complete my type checker for haskell-src-exts first. Which is not a small task, but one that has been started. That's good to know! I presume it's something like Haskell98 to start with? I'd be even more impressed (and possibly also concerned for your health) if you were going to tackle all of the extensions! I've been trying to find a student to write a haskell-src-exts type checker for me. It should use a particular kind of mechanism though, using constraints similar to [1]. Then, I want to adapt that to do transformations. What approach are you using? Maybe I can somehow steal your work... ;) Regards, Sean [1] http://www.staff.science.uu.nl/~heere112/phdthesis/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell at University in Munich
On Mon, Dec 5, 2011 at 00:18, Bartosz Wójcik wrote: If Munich and 200 km circle do not provide with any offer, perhaps you may know what is available in Europe, limiting language of study to [German, English, Polish]? I believe the following recent thread will help answer this question: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/93650 Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Tutorial/slides on pretty-printing combinators?
Do you know of any tutorial or slides from a talk on one of the pretty-printing libraries? It could be on Text.PrettyPrint.HughesPJ or uulib or any other, similar library. I'm thinking of developing slides for a course, and I'm looking for sources of inspiration. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Dutch National FP Day 2012
(Sent on behalf of Doaitse Swierstra) Despite some last minute changes to the planning we are happy to announce that the next Dutch functional programming day will take place on January 6, 2012, at the university campus De Uithof of Utrecht University. In case you want to give a presentation please send title, speaker and abstract to doai...@swierstra.net before Dec 1. We will collect the proposals and try to make an interesting program out of it. Further details will be placed on the site: http://www.cs.uu.nl/wiki/FPDag2012 Best, hoping to see you all, Doaitse ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [Haskell] Dutch National FP Day 2012
What is the language of the talks and the participants? English or Dutch? In past years the language of the talks has always been English. Also, most Dutch people speak English pretty well, I think. Yes, what Erik said. Also, even though previous years' websites (below) have been in Dutch, most (perhaps all) talking has been in English. http://www.staff.science.uu.nl/~jeuri101/Meetings/FPDag2008/ http://www.win.tue.nl/~japie/FP-dag-2009/programma.htm http://wiki.clean.cs.ru.nl/NL-FP_dag_2010 Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] compiler construction
Hi Timo, Now I look for Universities, which offer compiler construction, since I need that course, preferably in the UK, Ireland, Australia or New Zealand. Ideally it would be in Haskell of course. I currently work in a research group that is well known for their compiler construction research. You may have heard of UHC, the Utrecht Haskell Compiler [1]? If not, you should look into it. We have a master's course on compiler construction [2] taught by one of the architects [3] of UHC. There is even a second Haskell-ish compiler, Helium [4], that has shone the way towards better error messages. The people [5] in the Software Technology group [6] at Utrecht University do a lot of other interesting work, too. The topics include functional programming, generic programming, dependently typed programming, parser combinators, static analysis, type systems, etc. UU is based in the Netherlands, not one of the English-speaking locations you seem to prefer. But the lingua franca here is English and there are students and staff from all over, so it can seem like a more foreign place at times. We're happy to have more students interested in pushing the boundaries of language research. Regards, Sean [1] http://www.cs.uu.nl/wiki/UHC [2] http://www.cs.uu.nl/wiki/Cco [3] http://www.cs.uu.nl/wiki/Atze [4] http://www.cs.uu.nl/wiki/Helium [5] http://www.cs.uu.nl/wiki/Center/People [6] http://www.cs.uu.nl/wiki/Center ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MonadPlus versus Alternative
On Sun, Oct 30, 2011 at 04:02, Gregory Crosswhite wrote: So is there any difference between the interpretation of MonadPlus and Alternative, or is the only difference between them that the former applies to Monad whereas the latter applies to Applicative? Somewhat OT, but this led me to playing with ConstraintKinds: https://github.com/spl/sandbox/blob/master/ConstraintKindsAlternativeMonadPlus.lhs Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What library package fulfills these requirements?
Hi Han, On Fri, Oct 28, 2011 at 09:06, Han Joosten wrote: I am planning to give a workshop on FP using Haskell. The audience will be programmers with quite a bit of experience with conventional languages like Java and .net . I want to give them some feeling about FP. And hopefully, they will become interested so they want more... Mark Lentczner recently gave a great talk to a similarly experienced audience at Google. Video: http://www.youtube.com/watch?v=b9FagOVqxmI Code: https://github.com/mtnviewmark/haskell-amuse-bouche Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Google Knol and haskellers
On Wed, Oct 12, 2011 at 12:35, Yves Parès wrote: I re-head recently about Google Knol, which is IMO some crossing-over between a wiki and a blog. Are there some people that use it here to write haskell-related articles instead of a regular blog? As far as anybody outside Google knows, Knol has pretty much been abandoned. See http://googlesystem.blogspot.com/2011/01/abandoned-knol.html . I don't think it's worth contributing knowledge to it. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Question: Lazy Incremental Evaluation and Haskell?
Hi Benjamin, My question is, roughly, is there already an existing framework for incremental evaluation in Haskell? We at Utrecht have done some work on this: http://people.cs.uu.nl/andres/Incrementalization/ Simply put, if your computation is a fold/catamorphism, then you can easily take advantage of a generic framework for incremental evaluation. We haven't actually turned this into a library, but if you're interested, we can discuss doing that. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Type family instances in Haddock?
Would it be useful/worthwhile to have type/data family instances show up in Haddock just as type class instances do? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Where is SNMap for stable names?
On Sat, Sep 24, 2011 at 01:41, Edward Kmett wrote: You still need IO to get the stable name out to use. :) I don't understand this statement. Consider the lookup operation in the paper and in your System.Mem.StableName.Map: lookupSNMap :: SNMap k v - StableName k - IO (Maybe v) lookup :: StableName a - Map f - Maybe (f a) Unless you are intending f to be instantiated to IO -- which is not how I read it -- then, lookupSNMap is requiring some aspect of IO, probably mutability, and lookup is not. I am wondering if there is some fundamental difference between the two. Is the paper using immutability only for performance reasons? In that case, it's not a fundamental difference. Regards, Sean Sent from my iPad On Sep 23, 2011, at 5:33 AM, Sean Leather leat...@cs.uu.nl wrote: Hi Edward, On Thu, Sep 22, 2011 at 16:50, Edward Kmett wrote: I have a stable-maps package that provides lookup and inserting into a map via stable names. The paper mentions the need for a mutable finite map, and all the operations are IO. Do you know why this is and what's different with your pure implementation? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Where is SNMap for stable names?
Hi Edward, On Thu, Sep 22, 2011 at 16:50, Edward Kmett wrote: I have a stable-maps package that provides lookup and inserting into a map via stable names. The paper mentions the need for a mutable finite map, and all the operations are IO. Do you know why this is and what's different with your pure implementation? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Where is SNMap for stable names?
There is an abstract type called SNMap for stable names referred to in [1]. This has apparently disappeared from GHC a long time ago. Is it still available somewhere, or is there a suitable replacement for it? Regards, Sean [1] Stretching the storage manager: weak pointers and stable names in Haskell - http://research.microsoft.com/apps/pubs/default.aspx?id=67497 ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] efficient chop
On Wed, Sep 14, 2011 at 17:31, Ivan Lazar Miljenovic wrote: On 15 September 2011 01:24, Sean Leather wrote: On Wed, Sep 14, 2011 at 05:03, Kazu Yamamoto wrote: I would like to have an efficient implementation of the chop function. [...] Are there any more efficient implementations of chop? Any suggestions? chop xs = go xs id where go _ = id go (c:cs) ss | isSpace c = go cs (ss . (:) c) go (c:cs) ss | otherwise = ss . (:) c . go cs id Why the extra case for go? The otherwise guard can be part of the second case... Do you mean why include 'go (c:cs) ss' twice? That's merely because I was working through several versions and forgot to merge the second and third cases before sending the email. Nothing sinister. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] efficient chop
On Wed, Sep 14, 2011 at 05:03, Kazu Yamamoto wrote: I would like to have an efficient implementation of the chop function. [...] Are there any more efficient implementations of chop? Any suggestions? chop xs = go xs id where go _ = id go (c:cs) ss | isSpace c = go cs (ss . (:) c) go (c:cs) ss | otherwise = ss . (:) c . go cs id I haven't looked at the performance, but I would like to know how well it fares. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Idiomatic usage of the fixpoint library
On Sun, Sep 4, 2011 at 13:03, Roman Cheplyaka wrote: * Sean Leather [2011-09-04 12:48:38+0200] On Sun, Sep 4, 2011 at 12:31, Roman Cheplyaka wrote: I'm looking for an example of idiomatic usage of the fixpoint library[1]. [1]: http://hackage.haskell.org/package/fixpoint-0.1.1 I'm not sure if this counts for idiomatic usage, but you can check out our approach to incrementalization. http://people.cs.uu.nl/andres/Incrementalization/ Yeah, it has more or less the same problems as my code above. You essentially defined your tree twice (Tree and F (Tree)). For such a simple type it's fine, but if it was an AST with a few dozens of constructors, such approach would be unacceptable. True. Technically, one doesn't need Expr or Tree, right? But if you prefer to define your datatype that way, that's usually where I turn to code generation, possibly using Template Haskell, Data.Derive, or something else. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Idiomatic usage of the fixpoint library
On Sun, Sep 4, 2011 at 12:31, Roman Cheplyaka wrote: I'm looking for an example of idiomatic usage of the fixpoint library[1]. [1]: http://hackage.haskell.org/package/fixpoint-0.1.1 I'm not sure if this counts for idiomatic usage, but you can check out our approach to incrementalization. http://people.cs.uu.nl/andres/Incrementalization/ Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] XCode Dependency for HP on Mac
On Wed, Jul 27, 2011 at 05:55, Tom Murphy wrote: This may sound ignorant because, well, it is ignorant: I know very little about the underlying mechanics here. Installing the Haskell Platform currently requires XCode developer tools. To get XCode on my 10.6 machine, I... ... will check out the related discussion: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/89745 Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANNOUNCE: Haskell in the Cloud (http://quid2.org)
On Fri, Jul 22, 2011 at 12:00, Pasqualino Titto Assini wrote: Enter Quid2 http://quid2.org [1]: the half baked, barely tested, totally unsafe and spectacularly unoptimised Haskell in the Cloud system. Challenging... https://plus.google.com/104222093009939197511/posts/MpgUUayq78o Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to install GhC on a Mac without registering?
On Mon, Jun 6, 2011 at 16:47, Malcolm Wallace wrote: The ghc team already bundle a copy of gcc in their Windows distribution, precisely because it can be fiddly to get a working copy of gcc for that platform otherwise. I wonder if they would consider the possibility of shipping gcc on Mac too? (There may be good reasons not to do that, but let's have the discussion.) I would be in favor of this -- assuming it didn't create new problems -- especially if it meant the latest GHC installer could be used on older versions of Mac OS X. The Windows installer still works for Windows 2000, but the Mac installer requires the Snow Leopard. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] *GROUP HUG*
Hi Gregory, I had a similar experience on the scala-user list some time ago. I found most of the responses to my questions to be rather unproductive and superficial. I love the haskell-cafe community for their helpfulness and analytical approach. I left scala-user not long afterward partly because of the aforementioned issues and partly because lurking there and reading threads did not provide any enlightenment on using Scala. With haskell-cafe, I can just read and (attempt to) absorb new knowledge. At least for me, the signal-to-noise ratio is higher on haskell-cafe than scala-user. (YMMV, of course.) I'm not sure that the problem for the Scala community is growing pains. The Haskell community has been this way from the very beginning. In fact, the growing mix of people introduced to Haskell has lead to a great diversity of reactions: academic, hobbyist, getting-things-done, etc. For Scala, I think it's really due to the type of people that are attracted to the community. My impression is that more people are coming from Java programming than from academia. This probably has an effect on the community dynamics. (This is not meant to slight Java programmers. Rather, I think that the common perspective is more that of getting-things-done than deep-insight-into-the-problem.) I also applaud the Haskell community for being very open and helpful. I would like to thank everyone who contributes to this environment. Group hug, indeed! ;) Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fucntion composing
Prelude let h x y = (g 0 (f x y)) How to do pointfree definition of h? See the thread http://thread.gmane.org/gmane.comp.lang.haskell.cafe/70488for related material. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] mtlx has a nice design but is slow
I just refactored my type and transform system prototype (introduced in [1] but changed since then) from using mtlx [2] (type-indexed monad transformers described in [3]) to mtl using RWST. mtlx allowed me to cleanly separate the various monadic components in a convenient way. Unfortunately, I found it to be too slow. The refactoring was an experiment to see how slow. I was rather surprised: Running time of a compiled main with a list of tests: mtlx (7 transformers): 2 min 52 sec mtl (RWST): 0 min 13 sec It's frustrating to see such a huge performance gap for a better design. Regards, Sean [1] http://splonderzoek.blogspot.com/2011/03/draft-type-changing-program-improvement.html [2] http://hackage.haskell.org/package/mtlx [3] http://www.ittc.ku.edu/~marks/cgi-bin/pubs/monadfactory.pdf ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Could not deduce ... using functional dependencies with GHC7
On Fri, Mar 18, 2011 at 13:35, JP Moresmau wrote: These are GHC types, but here is a self-contained example: {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-} data Id=Id String data Result id =ResultId Id | ResultGen id data Sig id=IdSig Id | SigGen id class Search id a | a - id where search :: a - Result id instance Search Id Id where search i = ResultId i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g search (IdSig i)= search i The last line fails. I don't understand why this doesn't compile. This doesn't even work in GHC 6.12.3. The search call in the second case, IdSig, restricts the result to Result Id, which is less polymorphic than Result id. Either of the following are valid: instance Search Id (Sig Id) where search (SigGen g) = search g search (IdSig i)= search i instance (Search id id) = Search id (Sig id) where search (SigGen g) = search g Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Writer monad corresponds to synthesized attribute?
I have been attempting to translate something I did using UUAG into monadic code. It involved inherited, synthesized, and chained attributes. It has been said that such attributes correspond to the Reader, Writer, and State monads, respectively [1]. The former and latter are straightforward, but I'm somehow missing the correlation between the Writer monad and synthesized attributes. I couldn't figure out the appropriate combination of tell/listen/pass/censor to do what I was doing with a synthesized Map. I eventually gave up and passed the synthesized values along with the monadic result. Has anybody done this before? Regards, Sean [1] http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4/Why_Attribute_Grammars_Matter ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] H98, OOHaskell - getting started with objects in Haskell
Phil: I wanted to check whether Haskell offers reasonably easy object oriented programming It depends on what you're looking for, but in general, you won't find the same thing you may be used to in native OO languages. 1. OOHaskell doesn't seem to be available in the HackageDB (cabal) -- so how do I install it especially on Debian ? The paper and source are available via links on the website: http://homepages.cwi.nl/~ralf/OOHaskell/ . It appears that you could use darcs with the new repository: http://code.haskell.org/OOHaskell/ . 2. is OOHaskell the right way to go - is it standardised (H98) or is it extension and is it widely used and recommended ? It uses several language extensions beyond H98. AFAIK, it is not widely used. It was an interesting demonstration of the potential of the Haskell type system. I worked with it once, and it's nice research, but it hasn't yet been shown to be useful in practice. 3. Haskell 98 offers datatypes and some sort of monadic classes -- is it possible to build simple objects without OOHaskell ? 4. When I want object properties to change, when should I use IORef when STRef ? Once you become comfortable with Haskell, you will most likely find other ways to do things than the OO way. If you ask questions on this list about something you want to do, I'm sure you will get answers on how to do it the functional way. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] identity function
I've been reviewing the library, and have come unstuck with the *id*function. What's its purpose and can someone give me an example of its practical use. It's purpose is simply to be the identity function. The type says exactly what it does. Prelude :t id id :: a - a It's often useful in combination with higher-order functions. Prelude :t foldr (.) id foldr (.) id :: [a - a] - a - a Here's a slightly complicated way to add a list of numbers: Prelude foldr (.) id (map (+) [1..5]) 0 15 Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Managing multiple installations of GHC
On Thu, Dec 2, 2010 at 05:16, Robert Clausecker wrote: How can I install GHC 7 parallel to GHC 6.12 with the option to choose? My OS is GNU/Linux, my Distro is Ubuntu (Lucid). I created this for my Ubuntu VM: https://github.com/spl/multi-ghc Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Precedence of if then else
This may be a silly, but I occasionally run into a situation where I'm wondering what the effective precedence of if then else is. I was finally motivated to do a few experiments, and it seems like the precedence level is reset (below 0) after if, then, and else. λ if not $ False then here else x here λ if False then (++ y) $ x else here here λ if True then here else (++ y) $ x here I suppose I knew this was the case with if, but I had not given it much thought for then or else. Of course, it makes sense. It's the same for case and many other syntactic constructs. I was wondering where this was defined in the Language Report. I had looked for prose, but found nothing. Now, I look at it again (with more motivation) and see it (clearly) in the following excerpt of the grammar (Ch. 3 Expressions): exp → infixexp :: [context =] type (expression type signature) | infixexp infixexp → lexp qop infixexp (infix operator application) | - infixexp (prefix negation) | lexp lexp → \ apat1 … apatn - exp (lambda abstraction, n ≥ 1) | let decls in exp (let expression) | if exp [;] then exp [;] else exp (conditional) | case exp of { alts } (case expression) ... Plainly and simply, this says that all infix expressions (infixexp) are expressions (exp), and these can be found in if then else and case among others. So, while I was looking for something regarding precedence, it is actually defined straightforwardly in the grammar. In case others happen to search for the same thing I did, maybe this will provide them with an answer of sorts. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Working Generic/Polytypic Haskell extension
Hi Mulhern, I would like to teach a small section on polytypism/genericity in the functional programming using Haskell course I'm teaching. I won't, though, unless I can assign an actual programming exercise in polytypic programming, however brief. Can anybody recommend a functioning compiler that I can reasonably require the students to use in doing this assignment? I am not up-to-date on the current state of research in this topic in Haskell and hope that some people on the list can help me out. There is of course Generic Haskell [1], which works. It is not being maintained anymore, but it still does what it was designed to do. There are plenty of publications to use for resources. Currently, most of the work on datatype-generic programming generally ends up in libraries and not in language extensions. You can see quite a few on Hackage [2]. Many of them have links to publications for further study. At Utrecht University, we have a master's course on Generic Programming [3]. That may be more than you want, but you can refer to our slides for further information. We also use lecture notes [4] for this course. They provide a pretty good introduction to a few libraries, LIGD, EMGM, and SYB. Hope this helps! Let us know if you would like something else. Regards, Sean [1] http://www.cs.uu.nl/research/projects/generic-haskell/ [2] http://hackage.haskell.org/packages/archive/pkg-list.html#cat:generics [3] http://www.cs.uu.nl/wiki/GP [4] http://www.cs.uu.nl/research/techreps/UU-CS-2008-025.html ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Retargeting Haskell compiler to embedded/hardware
Don Stewart: tomahawkins: A few years ago I attempted to build a Haskell hardware compiler (Haskell - Verilog) based on the Yhc frontent. At the time I was trying to overcome several problems [1] with implementing a hardware description language as a light eDSL, which convinced me a proper compiler may be a better approach. Yhc was recommended as a good starting point since it had a simpler IR compared with GHC -- at least at the time. I am considering restarting this effort, but this time to target hard realtime embedded code. What is the recommended compiler to start from? I need an IR that is post type checking with as much desugaring as possible, and a code base that is relatively easy to splice and build. My other requirement is not to be bound to IO () for 'main'. The top level will be a monad, but with different semantics than IO. I would also like to reuse the standard library, with exception to the values related to IO. What are my options? Have you looked at Clash, the GHC to VHDL compiler? Links are always useful: http://clash.ewi.utwente.nl/ http://hackage.haskell.org/package/clash http://dutchhug.nl/static/dutchhugday-2010/clash.pdf http://wiki.clean.cs.ru.nl/images/8/86/Christiaan-from-haskell-to.pdf Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Scraping boilerplate deriving?
On Tue, Sep 14, 2010 at 10:24, Kevin Jardine wrote: I have a set of wrapper newtypes that are always of the same format: newtype MyType = MyType Obj deriving (A,B,C,D) where Obj, A, B, C, and D are always the same. Only MyType varies. A, B, C, and D are automagically derived by GHC using the {-# LANGUAGE GeneralizedNewtypeDeriving #-} feature. I would like to use some macro system (perhaps Template Haskell?) to reduce this to something like defObj MyType I've read through some Template Haskell documentation and examples, but I find it intimidatingly hard to follow. Does anyone has some code suggestions or pointers to something similar? This works in TH: [d|newtype Blah = Blah Int deriving (Num,Show,Eq)|] But the parameterized variations on this theme do not: derive1 name = [d|newtype $name = Blah Int deriving (Num,Show,Eq)|] Malformed head of type or class declaration derive2 name = [d|newtype Blah = $name Int deriving (Num,Show,Eq)|] parse error in data/newtype declaration I think it has something to do with the type of the splice. Perhaps you can look into further: http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/template-haskell.html Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: [wxhaskell-users] problems using macports?
On Thu, Sep 9, 2010 at 17:44, Eric Y. Kow wrote: On Thu, Sep 09, 2010 at 17:38:40 +0200, S. Doaitse Swierstra wrote: I am in my yearly fightto get a working combination of operating system (Snow Leopard), compiler version (6.12) , wxWidgets and wxHaskell on my Mac . After deleting most of my stuff, starting afresh, hours of building using macports etc. I finally get the message: I may have had a similar problem back in March: http://www.mail-archive.com/wxhaskell-us...@lists.sourceforge.net/msg00827.html Don't know if my explanation is sensible or not. Your observation seems to agree with several other links at http://www.google.com/search?q=macports+iconv+link . Some of them suggest renaming the Mac OS X header file iconv.h (rather than not using MacPorts). Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Slightly humorous: Headhunters toolbox (example for Germany)
On Sat, Aug 28, 2010 at 01:29, Vo Minh Thu wrote: It would be interesting to know some other sources: [...] number of attendees to e.g. Utrecht summer school on FP, ... Just a bit over 30, I think. And it was interesting to see a significant number of non-student participants. Perhaps around 20%. As an aside, we had some interesting projects, too. Sokoban in curses, DSP/sound DSL, regex visualization, Bash code escaping, etc. I hope to see some of them appear on Hackage soon. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Academic Haskell Course
Can anyone point me towards existing work I could use? Open course material and syllabuses I could use, with the necessary references? At Utrecht University: - http://www.cs.uu.nl/wiki/FP - for first-year bachelors - http://www.cs.uu.nl/wiki/Afp - for first-year masters - http://www.cs.uu.nl/wiki/USCS2010 - for late-year bachelors or early masters (two-week long summer school currently being taught) Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: String vs ByteString
Yitzchak Gale wrote: Sean Leather wrote: Which one do you use for strings in HTML or XML in which UTF-8 has become the commonly accepted standard encoding? UTF-8 is only becoming the standard for non-CJK languages. We are told by members of our community in CJK countries that UTF-8 is not widely adopted there, and there is no sign that it ever will be. And one should be aware that the proportion of CJK in global Internet traffic is growing quickly. So then, what is the standard? Being not familiar with this area, I googled a bit, and I don't see a consensus. But I also noticeably don't see UTF-16. So, if this is the case, then a similar question still arises for CJK text: What format/library to use for it (assuming one doesn't want a performance penalty for translating between Data.Text's internal format and the target format)? It appears that there are no ideal answers to such questions. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: String vs ByteString
Johan Tibell wrote: Here's a rule of thumb: If you have binary data, use Data.ByteString. If you have text, use Data.Text. Those libraries have benchmarks and have been well tuned by experienced Haskelleres and should be the fastest and most memory compact in most cases. There are still a few cases where String beats Text but they are being worked on as we speak. Which one do you use for strings in HTML or XML in which UTF-8 has become the commonly accepted standard encoding? It's text, not binary, so I should choose Data.Text. But isn't there a performance penalty for translating from Data.Text's internal 16-bit encoding to UTF-8? http://tools.ietf.org/html/rfc3629 http://www.utf8.com/ Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambdacats
On Fri, Aug 6, 2010 at 12:12 AM, Tony Morris wrote: Hello, does anyone happen to have the lambdacats page cached? The domain ( arcanux.org) and server have disappeared and the wayback machine doesn't have the images. On Fri, Aug 6, 2010 at 18:43, John Van Enk wrote: I happened to download them all (i think all) a while ago to torment my coworkers: http://sw17ch.com/dump/lambdacats.zip And from that to this: http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46 Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] lambdacats
Simon cat and Oleg cat are also missing, unfortunately. Also the 'catamorphism' picture with the banana peel (there may be others I can't recall, too). Well, I found what I could... http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46#960831913_rhDdG http://spl.smugmug.com/Humor/Lambdacats/13227630_eKt46#960824968_hNkLy I welcome any others you want to share or create. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments on Haskell 2010 Report
On Fri, Jul 9, 2010 at 16:23, Steve Schafer wrote: On Fri, 09 Jul 2010 10:07:06 -0400, brandon s. allbery wrote: I don't think I've ever seen them *followed* by commas. Preceded, always. In American English, they're always followed by commas, and preceded by comma, semicolon, dash or left parenthesis, depending on the specific context. One of the nice things about English is that there is often never an always. See http://grammar.quickanddirtytips.com/ie-eg-oh-my.aspx for a discussion. (For me personally, I prefer to minimize the juxtapositions of punctuation (e.g. . and ,). As long as there's not an editor looking over my shoulder telling me it's not acceptable, I will continue to do so.) As for future editions of the Haskell Report, one possibility to eliminate concerns about spelling and grammar would be to decide to follow a certain dialect and style. This would reduce the number of comma-related comments. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Comments on Haskell 2010 Report
On Fri, Jul 9, 2010 at 18:35, Steve Schafer wrote: On Fri, 9 Jul 2010 17:14:31 +0200, Sean Leather wrote: One of the nice things about English is that there is often never an always. See http://grammar.quickanddirtytips.com/ie-eg-oh-my.aspx for a discussion. Well, that page pretty much confirms what I said. In AMERICAN English, they're always followed by commas. The two sources mentioned on that page that suggest omitting the commas (Fowler's and Oxrford) are both based on UK English. And yet most of the other manuals describe the rule as usually, preferable/optional, and makes good sense. That refutes your claim that they're always followed by commas. ;) Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How easy is it to hire Haskell programmers
On Fri, Jul 2, 2010 at 15:43, Edward Kmett wrote: I've had a fairly easy time of hiring Haskell programmers. Does this mean your company actively uses Haskell in projects? Would you be willing/able to describe this work in more detail for the curious? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] www.haskell.org web server down?
It responds to pings but not http. http://downforeveryoneorjustme.com/www.haskell.org Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Parselib sample
I've thought about writing an article for The Monad Reader - moving from Graham Hutton's parsers to Parsec, if there's any interest I'll look into doing it. For the time being the main difference is probably that Parsec parsers generally use the TokenParser module for some of the combinators that Parselib provides directly. Using the TokenParser module requires a couple of tricks - import it qualified and re-define unqualified versions of the parsers you need - int, symbol, identifier - etc. I'd like a comparison of how to do similar things in Parsec and uu-parsinglib and polyparse and whatever other parser combinator library you want to throw in. I imagine a sort of cookbook, so that once you have become comfortable with one, you can reference this cookbook to figure out the similarities/differences with another. Also, here's something to add to the thread: I wrote a wrapper module for uu-parsinglib for the functional programming course at Utrecht. The goal was threefold: 1. Support the nice functionality of uu-parsinglib (e.g. error handling, efficiency) while simplifying the interface for beginner programmers, 2. Provide an interface very similar to Parselib which was covered in the course, and 3. Add documentation which was sorely missing from uu-parsinglib. The file (licensed to the public domain) is attached. Regards, Sean UUParsingSimple.hs Description: Binary data ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure
I have little experience with Haskell, but I haven't seen Either used in contexts other than error/success. If you could point me to some piece of code that uses it in a different way it would be great. One example use case is datatype-generic programming. {-# LANGUAGE TypeFamilies #-} Suppose I have a type class that gives me a unique representation for a type. The functions 'from' and 'to' allow me to convert from a value of that type to a value in its representation. An instance of 'Representable' should encode an isomorphism between some type 'a' and its representation type 'Rep a'. An isomorphism means that we can translate between 'a' and 'Rep a' without losing important information such as the structure of the value. class Representable a where type Rep a from :: a - Rep a to :: Rep a - a I can establish some types from the Haskell Prelude as representations for other types. Here, I use the unit type (), 'Either' as is the topic of the current thread, and the pair type (,). instance Representable () where type Rep () = () from = id to = id instance (Representable a, Representable b) = Representable (Either a b) where type Rep (Either a b) = Either a b from = id to = id instance (Representable a, Representable b) = Representable (a, b) where type Rep (a, b) = (a, b) from = id to = id The reason that I pick (), 'Either', and (,) is that we can represent many typical Haskell user-defined datatypes with these so-called basic types. A simple example is 'Bool'. In this case, the representation type for 'Bool' is 'Either () ()' since 'Bool' can be either 'True' or 'False'. The constructors of 'Bool' take no arguments, so we can use () to fill in the arguments for the 'Left' and 'Right' constructors of 'Either'. instance Representable Bool where type Rep Bool = Either () () from x = case x of False - Left () True - Right () to x = case x of Left () - False Right () - True Here is a more interesting example with constructors that take zero, two, and three arguments. data MyType a b = Zero | Two a a | Three a b a In order to represent 'MyType', we use nesting of 'Either' and pairs. This allows us to utilize the basic types defined above to represent more complicated types. instance Representable (MyType a b) where type Rep (MyType a b) = Either () (Either (a, a) (a, (b, a))) from x = case x of Zero - Left () Two a1 a2 - Right (Left (a1, a2)) Three a1 b1 a2 - Right (Right (a1, (b1, a2))) to x = case x of Left () - Zero Right (Left (a1, a2))- Two a1 a2 Right (Right (a1, (b1, a2))) - Three a1 b1 a2 Now, what's the real point of all this? Well, if we can define functions over the basic types (unit, 'Either', and pair), we can easily extend those functions to other types that can be represented by the basic types. Some canonical examples are equality and ordering. There already exist instances for the basic types, so defining instances for 'MyType' is trivial. We simply convert each 'MyType' value into its representation as defined above. The functions then act on the representation value. instance (Eq a, Eq b) = Eq (MyType a b) where x == y = from x == from y instance (Ord a, Ord b) = Ord (MyType a b) where compare x y = compare (from x) (from y) You might say that we already have deriving (Eq, Ord), and that's true. But the implementation of deriving is specified by the Language Report and built into each compiler. If you come up with a new generic function, you won't have deriving for that. It's also (currently) much easier to write the above than to build a new deriving implementation for a compiler. There are many examples of generic functions and uses of datatype-generic concepts in Haskell. Just search Hackage for generics. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Is anyone using Haddock's support for frames?
* We probably want to replace the frames with something more modern (like a sidebar on the same page) in the future * We are rewriting the HTML backend and it would be nice to avoid unnecessary work So if you're using this feature and want to keep it, please speak up! Somewhat OT, but is there a place where we can request/review features in the new HTML presentation of Haddock. Are there any mockups of what the pages might look like? I've had some ideas pop around my head every time I look at documentation. ;) Thanks, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] MonadPlus or Alternative or ...?
On Sun, May 2, 2010 at 12:07, Sebastian Fischer wrote: On May 2, 2010, at 11:10 AM, Sean Leather wrote: Or should I make my own class? Then, there obviously won't be any instances for existing types other than your own (which might be a good or bad thing). You may want to do this, if you don't want to require either (=) or (*), which may not be supported for reasonable instances of your own class. I don't really want to do this option, because it increases the understanding overhead needlessly, I think. Everything else that is provided by Applicative/Monad doesn't matter. I require only the three operations above and do not disallow extra operations. By not making your own class, you prohibit types that do not support * (or =). That's fine, but an additional burden to instance writers. By not listing extra operations in your own class you would not disallow them. You require them by not making your own class without them. Understood and agreed. Having my own class would be the most flexible in what it allows and disallows. But still, your wish to reuse existing classes may be a fine reason to impose an additional burden. There is an additional maintenance burden that I've recently become aware of, considering I haven't done a very good job of maintaining my own code. ;) To use my own class, I should reasonably provide instances for everything that I possibly can. This would include (at least) lists, Maybe, WrappedAlternative, and WrappedMonadPlus. Who knows? I may change my mind in a while. In that case, would you have any suggestions on a name for such a class or names for the methods? ;) class C f where zero :: f a one :: a - f a append :: f a - f a - f a Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] MonadPlus or Alternative or ...?
I want to generalize a set of functions from lists to some functor type. I require the following three operation types. f a a - f a f a - f a - f a Should I choose MonadPlus and use these? mzero return mplus Or should I choose Alternative and use these? empty pure (|) Or should I make my own class? Or is there another option? Thanks, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)
On Sun, Apr 18, 2010 at 01:46, Don Stewart wrote: leather: 2. What is the difference between Haskell and the Haskell Platform? I see one or the other in various places. To get from www.haskell.org to downloading the Mac software, I go through Download Haskell, Get the Haskell Platform Mac, and Download Haskell for Mac OS X (intel). Well, for one, we have characterized the difference between GHC and the Haskell Platform as: GHC is to the HP as Linux Kernel is to Linux Now, Haskell for newcomers might mean toolchain on my machine -- which is the Haskell Platform. Or it might mean the language. We try to ensure advertising for the HP makes it simple: Download Haskell, but documentation pages carefully describe the fact that the HP is a development environment for the Haskell language. It just occurred to me to check what Sun/Oracle does for Java. I guess what is on haskell.org is no worse than what is on http://java.com/en/download/ . But perhaps answering such questions as What is Haskell? or Why download the Haskell Platform? as well as a short blurb about the use of the terms Haskell and Haskell Platform would help. Personally, I prefer to separate the name of the language from the name of the development tools, because I think that causes unnecessary confusion. End-users do not need to care about Haskell, unlike Java since they need the JRE, so potential developers and students are the audience. This group needs the Haskell Platform for developing with Haskell, and having the tools referred to as Haskell Platform is clear enough (imho) without having to call the tools Haskell. In the end, whatever the choice, the language on haskell.org should probably be somewhat more consistent. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: help with Haskell programming
This is the annoying part about Haskell . I can not understand composition . One of the ways of understanding composition (and many other functions in Haskell) is by trying to understand its type. Here it is shown by looking at the type in the interpreter GHCi. *Main :t (.) (.) :: (b - c) - (a - b) - a - c It's a function that takes three arguments, the first two of which are functions, and the third is something else. Since (.) is a polymorphic function, we can tell everything about it (if we ignore certain other features of Haskell which are not immediately relevant). To give names to things, let's say composition is declared as follows: (.) f g x = ... We know that the type of x must be the same as the type of the argument to the function f. The result type of f is the same and the input type of g. The result type of g is the result type of (.). From these observations, we know that (.) applies g to x and f to the result of that. We can even write that definition down. (.) f g x = f (g x) But, in the case of (.), we don't need to look at the definition to understand how it works. We can get all the information from the type. The next step in understanding (.) is seeing how it's used. If you want to compose two functions, you can use their types to figure out what the result is. You mentioned (.) (||), so let's look at that first. Then, we can use GHCi to verify our understanding. The type of (||) is Bool - Bool - Bool or, equivalently, Bool - (Bool - Bool) (since - is right associative). If we apply (.) to (||), then we can substitute parts of the type of (||) into the type of (.) to figure out the type of (.) (||) (which is equivalent to ((||) .). First, note the types of the two components: (.) :: (b - c) - (a - b) - a - c (||) :: Bool - (Bool - Bool) Then, since (||) is plugged into the first argument of (.), we bind the right-hand sides below (from the type of (||)) to the left-hand sides (from (.)): b = Bool c = Bool - Bool The resulting type is: (.) (||) :: (a - Bool) - a - Bool - Bool and GHCi agrees. If you are looking for something of this type, then you've found it. Otherwise, you need to rethink your definition. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: haskell-src-exts 1.9.0
Hi Niklas, I'm pleased to announce the release of haskell-src-exts-1.9.0! * On hackage: http://hackage.haskell.org/package/haskell-src-exts Any idea why the Haddock docs have not been generated for this version? There's also no built on available. Is it an issue with the server? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: haskell-src-exts 1.9.0
On Thu, Apr 15, 2010 at 12:00, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: Sean Leather leat...@cs.uu.nl writes: I'm pleased to announce the release of haskell-src-exts-1.9.0! * On hackage: http://hackage.haskell.org/package/haskell-src-exts Any idea why the Haddock docs have not been generated for this version? There's also no built on available. Is it an issue with the server? Looks built to me... Hmm, now it does. Apparently, the server saw my email and responded nicely. http://hackage.haskell.org/packages/archive/haskell-src-exts/1.9.0/logs/success/ Thanks, Hackage! Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: haskell-src-exts 1.9.0
Hmm, now it does. Apparently, the server saw my email and responded nicely. Well, it takes half an hour or so... Yes, version 1.9.0 of haskell-src-exts was uploaded on Sun Apr 11 10:43:03 UTC 2010, but the ghc build is dated as modified on 15-Apr-2010 02:42 (in some unknown timezone) according the log http://hackage.haskell.org/packages/archive/haskell-src-exts/1.9.0/logs/success/. I believe that's longer than 30 minutes. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Dutch HUG Day: Program and Call for Participation
[Apologies for multiple copies.] --- Dutch HUG Day 24 April 2010 Ordina office Niewegein, The Netherlands --- *** *** Please register! *** *** Email Sean Leather leat...@cs.uu.nl by 20 April! *** INTRODUCTION To celebrate our first anniversary, the Dutch Haskell Users Group (HUG) invites Haskell and functional programming enthusiasts in the Netherlands and surrounding area to an afternoon symposium. The Dutch HUG is an informal group with monthly meetings including talks on novel applications of Haskell and socializing in the neighborhood pub. The group was founded on Sunday, April 19, 2009 at the Haskell Hackathon hosted in Utrecht. After a successful year, we renew the trend with the Dutch HUG Day. INVITATION *** Please send an email to Sean Leather leat...@cs.uu.nl by Tuesday, 20 April! *** Join us for a half day of fun and functional programming! We have some great praatjes (the Dutch word for talks) lined up. (Just in case you were confused by my Call for Praatjes, all talks will be in English.) Along with talks, you can join us afterwards for a buffet dinner, graciously provided by our sponsor Ordina. The registration will allow Ordina to know how many people to expect and to satisfy their security concerns. They are also looking for recruiting options and will send attendees an email describing potential opportunities. PROGRAM We are happy to announce a preliminary program. Note that the particular titles or order of talks may change, but the general schedule should remain the same. 13:00Reception 13:30Welcome 13:45Lightweight Program Inversion -- Janis Voigtländer (University of Bonn) 14:00Functional Programming in the Industry? -- Stef Joosten (Ordina, Open University of the Netherlands) 14:30BlazeHtml: Design of a Blazingly Fast HTML Combinator Library -- Jasper van der Jeugt (Ghent University) 15:00Functional Programming at typLAB -- Erik Hesselink (typLAB) 15:30Break 16:00Cλash: Haskell-ish Hardware Descriptions -- Matthijs Kooijman (formerly University of Twente) 16:30Why Haskell Does Not Matter -- Stefan Holdermans (Vector Fabrics) 17:00Lightweight Monadic Regions -- Bas van Dijk (Radboud University Nijmegen, Sensor Sense) 17:30Sirenial: Type-safe SQL Wrapper -- Martijn van Steenbergen (Utrecht University) 17:40Discussion 18:00Dinner 19:00Depart 19:30Drinks LOCATION The event will be held at the Ordina office in Niewegein, a town not far south of the city of Utrecht. You can get there by train to Utrecht Centraal and tram (the Utrecht sneltram) to P+R Westraven. Details on the location can be found at the following link, and we will put more information on our website soon. * http://www.ordina.com/Vestigingen/Nieuwegein.aspx SPONSOR We are grateful to Ordina for allowing us to host this event on their premises. They are also kindly providing drinks during the breaks and dinner afterwards for all participants. You should come and hear from our host how they make use of functional programming. * http://www.ordina.com/ in English * http://www.ordina.nl/ in het Nederlands ORGANIZERS * Sean Leather * Chris Eidhof MORE INFORMATION * Dutch HUG: http://dutchhug.nl/ * Dutch HUG Day: http://dutchhug.nl/DutchHugDay/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] multi-ghc: Managing Multiple GHC Distributions
I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others. http://github.com/spl/multi-ghc Feedback welcome. I'd also like to know if something similar exists. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] multi-ghc: Managing Multiple GHC Distributions
On Thu, Apr 8, 2010 at 13:49, Bas van Dijk v.dijk@gmail.com wrote: On Thu, Apr 8, 2010 at 11:00 AM, Sean Leather leat...@cs.uu.nl wrote: I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others. http://github.com/spl/multi-ghc Feedback welcome. I'd also like to know if something similar exists. Does this also work with a system installed ghc? These are usually installed in /usr (I'm using Gentoo Linux): $ ls -l /usr/bin/ghc* lrwxrwxrwx 1 root root 10 dec 22 00:22 /usr/bin/ghc - ghc-6.12.1 -rwxr-xr-x 1 root root 279 dec 22 00:20 /usr/bin/ghc-6.12.1 lrwxrwxrwx 1 root root 11 dec 22 00:22 /usr/bin/ghci - ghci-6.12.1 -rwxr-xr-x 1 root root 61 dec 22 00:20 /usr/bin/ghci-6.12.1 lrwxrwxrwx 1 root root 14 dec 22 00:22 /usr/bin/ghc-pkg - ghc-pkg-6.12.1 -rwxr-xr-x 1 root root 262 dec 22 00:20 /usr/bin/ghc-pkg-6.12.1 The ghc-config Bash script in multi-ghc uses symlinks to determine which is the current version to use. The instructions on the GitHub page explain it in detail, but here's how my setup works. * I create /opt/ghc for storing GHC, clone the multi-ghc repository (or copy the files) here. * I create /opt/ghc/6.10.4/src, download http://www.haskell.org/ghc/dist/6.10.4/ghc-6.10.4-i386-unknown-linux-n.tar.bz2, and untar it here. * cd ..; ln -s ../Makefile; make install ghc-config creates a $HOME/.ghc-config directory for tracking the current version and symlinks. Now, the key for your situation (I think) is your $PATH. If you append $HOME/.ghc-config/ghc/bin to your $PATH after /usr/bin, then you can use ghc-6.10.4 to call this specific version. Unfortunately, there is still a problem. ghc-config also manages $HOME/.cabal as a symlink for the current version. So, that would most likely conflict with your setup. There may be a way to fix that, though I haven't looked into it, or I could separate the cabal configuration from the ghc configuration. If so, I think I'm going to use this tools since I occasionally like to try out ghc-HEAD. multi-ghc should also work for doing this. As long as you install it as /opt/ghc/6.13.blah (or whichever directory you want to use instead of /opt/ghc). This was one of the goals of the design. There's more documentation in the README.md and scripts. I'm happy to improve upon it if something doesn't work. Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] multi-ghc: Managing Multiple GHC Distributions
On Thu, Apr 8, 2010 at 14:00, Bernie Pope florbit...@gmail.com wrote: On 8 April 2010 19:00, Sean Leather leat...@cs.uu.nl wrote: I created a few tools to help me manage multiple GHC distributions in a Bash shell environment. Perhaps it's useful to others. http://github.com/spl/multi-ghc Feedback welcome. I'd also like to know if something similar exists. I wonder if you could achieve the desired result with the Modules Project: http://modules.sourceforge.net/ We use it at work for managing multiple versions of lots of different programs on a shared machine. It looks interesting! Thanks. It makes me sad to see it written in Tcl. I spent way too much time with the language at my last job and did not enjoy it. But I grant that that is not a reason to avoid using it. I actually started out doing as they do, changing the PATH, but I decided that was not a great solution for two reasons: (1) It's inflexible and precludes the ability to set my PATH as I like. (2) It requires sourcing a script instead of executing it. I didn't like having no separation between my environment and the script's environment. It was too easy to introduce spurious environment variables. It would be nice if such a tool can potentially be written to work on Windows as well. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: Haskell+Cassandra was: RE: [Haskell-cafe] Re: Haskell.org re-design
On Tue, Apr 6, 2010 at 11:47, Johan Tibell wrote: On Tue, Apr 6, 2010 at 11:41 AM, Dr. Martin Grabmüller martin.grabmuel...@eleven.de wrote: Maybe a bit off-topic, but as Johan mentioned the Cassandra web site... Are there any Haskellers out there using Cassandra with Haskell? Not yet but I plan to write a binding for it if I ever get time. :) Apparently, somebody used it long enough to write this: http://hackage.haskell.org/package/cassandra-thrift Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Confusions about the Haskell Platform (for Mac)
1. Why can't the platform download site be hosted on www.haskell.org instead of hackage.haskell.org? I see that there's a redirect, but (imho) it would be ideal to have www.haskell.org/platform be the standard URL in my browser. It is easier to remember (for typing) and more obvious (for appearances). 2. What is the difference between Haskell and the Haskell Platform? I see one or the other in various places. To get from www.haskell.org to downloading the Mac software, I go through Download Haskell, Get the Haskell Platform Mac, and Download Haskell for Mac OS X (intel). 3. By looking at http://hackage.haskell.org/platform/mac.html , I have no idea what I'm going to get when I click the Download Haskell for Mac OS X (intel) link. It would be nice to know what I'm getting myself into before I commit to waiting for this 137.9 MB file. Thanks to the wonder of deep links, one can also not be expected to traverse the path that I did in #2. Similarly, if I come to this link directly, I have no easy way of navigating to try to figure out what Haskell or GHC is. 4. The current link for the Mac image points to http://hackage.haskell.org/platform/2010.1.0.0/haskell-platform-2010.1.0.1-i386.dmg. Note the inconsistency between the version in the directory and file names. 5. The directions on http://hackage.haskell.org/platform/mac.html say: After downloading: * Open the .dmg file * Follow the install instructions I see no install instructions in the .dmg file. I only see the following files: * GHC-6.12.1-i386.pkg * Haskell Platform 2010.1.0.1.pkg * Uninstall GHC 6. Since there are no install instructions, I am not sure which .pkg to install first. Of course, fix #3 and you hopefully fix this one. 7. Why can't I have a single .pkg file? Why do I have an Uninstall GHC and not an Uninstall Haskell Platform? -- I don't expect all of the above to necessarily have a direct solution. They are just my observations to share. Some of them are from the point of view of a newcomer, and some are from a perfectionist. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: Confusions about the Haskell Platform (for Mac)
On Tue, Apr 6, 2010 at 13:47, Sean Leather wrote: 1. [...] 7. 8. The binaries do not work on Leopard (10.5.8). $ /usr/local/bin/cabal dyld: unknown required load command 0x8022 Trace/BPT trap This was previously reported at http://thread.gmane.org/gmane.comp.lang.haskell.cafe/71747/focus=71944 and Gregory Collins is apparently working on a fix. I'm happy to test a new version, but it would be nice to have an uninstaller (that cleans up the symlinks in /usr/local/bin too). Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] [OT?] Haskell-inspired functions for BASH
A question of my own: is there any written design (an academic paper would be perfect) of a functional shell language? A few: http://www.citeulike.org/user/spl/tag/shell More resources: http://www.cse.unsw.edu.au/~pls/thesis-topics/functionalshell.html Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Confusions about the Haskell Platform (for Mac)
Hi Gregory, Thanks for the reply. Gregory Collins wrote: Sean Leather writes: 4. The current link for the Mac image points to http://hackage.haskell.org/platform/2010.1.0.0/haskell-platform-2010.1.0.1-i386.dmg . Note the inconsistency between the version in the directory and file names. You can think of that one as the second edition of the 2010.1 beta version. Agree that the directories should match. This is, of course, relatively minor. One alternative is to change the directory name to exclude the lowest version(s), e.g 2010.1/haskell-platform-2010.1.0.1-i386.dmg, so that when new intermediate versions are uploaded, the directory name still makes sense and doesn't need to change. Too bad the installer still doesn't work -- I'm working on it everyone, but the Mac installer system is incredibly crufty and broken, and Snow Leopard broke a lot of stuff for me. Is it possible to build the installer on a Leopard system/virtual machine such that it will install on a Snow Leopard system? 5. The directions on http://hackage.haskell.org/platform/mac.html say: After downloading: * Open the .dmg file * Follow the install instructions I see no install instructions in the .dmg file. I only see the following files: * GHC-6.12.1-i386.pkg * Haskell Platform 2010.1.0.1.pkg * Uninstall GHC When you mount the .dmg file a Finder window should pop up with the install instructions in a background image. Let me guess: this isn't working in Leopard? I should put a readme in there. Yes, I'm using Leopard. A README file should do the trick. 7. Why can't I have a single .pkg file? Short answer: I can't figure out how, and not for lack of trying, either. What I do is take the binary installer that the GHC guys build as a starting point. Despite many hours of reverse-engineering I cannot for the life of me figure out how to extract the GHC installer package from the binary metapackage. I'm completely ignorant of how the installer packages work, but is it possible to have one package refer to another? Thus, one installer could initiate another. Then, at least there is only one click needed for the whole thing. My experience has been that if you unxar the metapackage and try to copy the included package file into a new metapackage, the mac installer tools barf. Long-term, I'm planning on just building GHC from source so I can package a one-click installer, but I don't have infinite time for this project and doing psychic battle with the evil warlocks who cooked up the Mac installer is a challenge. I see you have the source at http://github.com/gregorycollins/haskell-platform-osx-installer . I can try to look at it at some point. If anyone has expertise in this area and a willingness to help, please contact me off-list. Why do I have an Uninstall GHC and not an Uninstall Haskell Platform? The platform installer is supposed to erase previous platform editions before it installs itself. That's good. Is it possible to include an uninstaller as well? Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Haskell.org re-design
On Mon, Mar 29, 2010 at 16:24, Simon Marlow wrote: On 29/03/2010 13:20, Christopher Done wrote: On 29 March 2010 11:19, Simon Marlow wrote: Is the footer necessary? I dislike sites that have too many ways to navigate, and the footer looks superfluous. The footer will probably be off the bottom of the window in any case, which reduces its usefulness as a navigation tool. Footer navigations are a way to provide a bit of a sitemap without cluttering the top nav, good for SEO, and to provide the user with an overview of the hierarchical structure of the site on every page. IMHO, these aren't compelling reasons. Note that already on your page there is an inconsistency between the tabs at the top and the headings at the bottom: I don't know where to look to find the content I want. Put the navigation in one place. A sitemap: sitemaps are for robots. If you're worried about cluttering up the page, use drop-down menus. SEO: we shouldn't compromise the usability or appearance of the site for SEO. If we do it right, SEO takes care of itself - and it's not like we care that much about SEO here, we're not competing with other sites to sell you Haskell. I like something like this footer (though I don't think this is a great one: page-specific wiki actions doesn't belong, and I don't get the Reports column). It clearly doesn't serve as main navigation. For me, it's the where do I go next collection of links for when I've read the page. I think it can improve usability, not hurt it. As for SEO, I don't think the concern should be do we show up high in the ranks? but rather does a query in a search engine take you to the most appropriate page? I've long been frustrated by Google not being able to find good answers to my Haskell-related questions. If there's anything we can do to improve this issue by changing the page layout and structure of haskell.org, then I'm all for it. This in itself is a matter of usability. Regards, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Are there any female Haskellers?
On Sat, Mar 27, 2010 at 23:09, Leon Smith wrote: I've heard rumors that in the early days of programming, that women were in the majority, or at least they represented a much greater proportion of programmers than they do now. They're not just rumors: http://www.witi.com/center/witimuseum/halloffame/1997/eniac.php Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Call for Praatjes: Dutch HUG Day
From ZuriHac, we bring you... *Call for Praatjes: Dutch HUG Day* To celebrate our first anniversary, the Dutch Haskell Users Group (HUG) invites Haskell and functional programming enthusiasts in the Netherlands and surrounding area to a short symposium. The Dutch HUG is an informal group with monthly meetings including talks on novel applications of Haskell and socializing in the neighborhood pub. The group was founded on Sunday, April 19, 2009 at the Haskell Hackathon hosted in Utrecht. After a successful year, we will continue the trend with the Dutch HUG Day. The Dutch HUG Day will be held in Utrecht on the afternoon of Saturday, April 24, 2010. The actual location is not confirmed; however, we will send out a notice as soon as it is known. *PRAATJE PROPOSALS* We seek people to give talks or praatjes in Dutch. The topic can cover anything in the functional programming or, more specifically, Haskell world. It may be your latest pet project, current research, or simply a demonstration of something cool that you found. The audience will be coming with a broad range of backgrounds, so praatjes should be oriented towards people having a general knowledge of Haskell programming. You can choose from one of the formats and topics below, or feel free to suggest something different. If you are interested in presenting, please send your proposal to Sean Leather by Saturday, April 3. More details are below. *FORMATS* - Talks (20 min) - Tutorials (25 min) - Lightning talks (5 min) - Demos (5 min) *TOPICS* - Development or design of a library or application - Comparison of libraries, applications, or languages - Lead a focused discussion (e.g. web programming options in Haskell) - Functional pearl (a fun talk) - Current research topic - Functional programming in industry - Experience report - Your favorite piece of software (and why) - Anything else (related to Haskell or functional programming) that you find interesting *IMPORTANT DATES* Praatje Proposal Deadline: Saturday, April 3 Dutch HUG Day: Saturday, April 24 *CONTACT* Send your proposal to Sean Leather: leat...@cs.uu.nl Dutch HUG: http://dutchhug.nl/ Dutch HUG Day: http://dutchhug.nl/DutchHugDay/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: How do you rewrite your code?
*How do you rewrite your code to improve it?* Edward Kmett just introduced one in another thread. Simplifying, it would be this: For all x, y, f: do { x' - x ; y' - y ; return (f x' y') } -- f $ x * y This is a great example, because (1) it reduces clutter and temporary names and (2) requires significant background knowledge on monads and idioms. We can also generalize this to functions f with increasing arity (f $ x * y * z, etc.). Beginners would not get this, but once you know this rule, it can greatly improve your coding style. Similarly with liftM2, liftM3, etc. as mentioned by Stephen. Any other useful tidbits to share? Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] How do you rewrite your code?
There are numerous threads on the Haskell Café involving rewriting, refactoring, refining, and in general improving code (for some definition of improve). I am interested in seeing examples of how Haskell code can be rewritten to make it better. Some general examples are: - Eta-reduce - Make more pointfree - Introduce monadic operators or do-notation - e.g. for Maybe, lists, State - Eliminate monadic operators or do-notation - Generalize types - e.g. change map to fmap, (++) to mappend - Use instances of Functor, Applicative, Alternative, Category, Arrow, Monoid, Traversable, etc. - Use library functions from Data.List, Data.Map, Data.Set, etc. - Use some form of generic programming (e.g. SYB, Uniplate, EMGM, Alloy) - Use other libraries not included in the Platform My question is simple: *How do you rewrite your code to improve it?* You can answer this in any way you like, but I think the most useful answer is to show a reasonably small, concrete example of what your code looked like before and after. Also, please describe how you think the rewrite improves such code. - Is it better style? More useful? More efficient? - Are the types (before and after) the same? - Are the semantics the same? - How did you prove or test equivalence? (e.g. Can you use equational reasoning to confirm the rewrite is valid? Did you use QuickCheck?) Here is an example that I find myself doing occasionally. For all x, f: x = return . f -- fmap f x or f $ x -- requires importing Control.Applicative I think the right-hand side (RHS) is more concise and simpler. The types here do change: the type constructor has a Monad constraint in the left-hand side and a Functor constraint in the RHS. Types that are Monad instances are generally also Functor instances, so this is often possible. I'm convinced the semantics are preserved, though I haven't proven it. What's an example of a rewrite that you've encountered? Thanks, Sean ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Interested in the Dutch HUG Day (24 April 2010)?
In honor of the first anniversary of the Dutch Haskell Users Group (formed at Hac5 in Utrecht), we are planning a mini symposium to bring together Haskell and functional programming enthusiasts in the Netherlands and surrounding area. *The Dutch HUG Day will be held on Saturday, 24 April.* Please mark that date in your calendar. The remaining details are being worked out. In order to help us with this process, we have created a short survey. If you are even remotely considering attending, please take a moment to fill out a form with your name and the activities that interest you. * http://spreadsheets.google.com/viewform?formkey=dGVuVTdnZEl0ZDE3MEVweUtRdmlnZGc6MA Note that this does not commit you to anything. We will only use this information to help plan the event (e.g. determine the number of seats at the location and the types of activities). For more information about the Dutch HUG, visit the wiki page and sign up for the mailing list. * http://www.haskell.org/haskellwiki/Dutch_HUG * http://groups.google.com/group/dutch-hug Thanks for your time! Sincerely, The Dutch HUG Day planning team ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe