Re: CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-24 Thread Francesco Mazzoli
You can specify the pre-processor in the `ghc-options' field in the cabal file, e.g. ghc-options: -pgmPcpphs Francesco On 23 December 2014 at 17:14, Brandon Allbery allber...@gmail.com wrote: On Tue, Dec 23, 2014 at 11:10 AM, Dominic Steinitz domi...@steinitz.org wrote: How very clever

Re: CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-24 Thread Francesco Mazzoli
I forgot to mention that `cpphs' can mimick gcc's cpp, with the flag `-cpp'. In Agda we have ghc-options: -pgmPcpphs -optP--cpp Francesco On 24 December 2014 at 10:50, Francesco Mazzoli f...@mazzo.li wrote: You can specify the pre-processor in the `ghc-options' field in the cabal file

Re: [Haskell-cafe] ordNub

2013-07-14 Thread Francesco Mazzoli
At Sun, 14 Jul 2013 07:31:05 -0400, Clark Gaebel wrote: Similarly, I've always used: import qualified Data.HashSet as S nub :: Hashable a = [a] - [a] nub = S.toList . S.fromList And i can't think of any type which i can't write a Hashable instance, so this is extremely practical.

GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
Hi list, I had asked this on haskell-cafe but this looks particularly fishy, so posting here in case it is an issue: {-# LANGUAGE GADTs #-} data Foo v where Foo :: forall v. Foo (Maybe v) -- Works foo1 :: Foo a - a - Int foo1 Foo Nothing = undefined

Re: GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
At Wed, 19 Jun 2013 11:25:49 +0100, Francesco Mazzoli wrote: Hi list, I had asked this on haskell-cafe but this looks particularly fishy, so posting here in case it is an issue: {-# LANGUAGE GADTs #-} data Foo v where Foo :: forall v. Foo (Maybe v

[Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
Hi list, I have stumbled upon a strange annoyance: {-# LANGUAGE GADTs #-} data Foo v where Foo :: Foo (Maybe v) -- This doesn't work foo1 :: a - Foo a - Int foo1 Nothing Foo = undefined foo1 (Just x) Foo = undefined -- This does foo2 :: a - Foo

Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
At Wed, 19 Jun 2013 10:03:27 + (UTC), AntC wrote: Hi Francesco, I think you'll find that the 'annoyance' is nothing to do with GADTs. I suggest you take the type signature off of foo1, and see what type ghc infers for it. It isn't :: a - Foo a - Int. [...] Yep, that message explains

Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Francesco Mazzoli
At Wed, 19 Jun 2013 06:59:00 -0400, Brent Yorgey wrote: Yes, I was going to suggest switching the argument order before reading your message. This is an interesting way in which you can observe that Haskell does not really have multi-argument functions. All multi-argument functions are really

Re: [Haskell-cafe] Mutually recursive modules

2013-05-08 Thread Francesco Mazzoli
At Wed, 8 May 2013 09:46:08 +0300, Roman Cheplyaka wrote: I wonder whether it's always possible to break cycles using GHC's .hs-boot files. Consider the following schematic example: module A where import B data A f :: B - A f = undefined B.g module B where

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-04 Thread Francesco Mazzoli
At Sat, 04 May 2013 09:34:01 +0100, Jon Fairbairn wrote: α-equivalence on the Böhm trees — normal forms extended to infinity. I suppose that counts as “some semantics” but its very direct. Ah yes, that makes sense. Thanks! Francesco ___

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-03 Thread Francesco Mazzoli
At Fri, 03 May 2013 16:34:28 +0200, Andreas Abel wrote: The answer to your question is given in Boehm's theorem, and the answer is no, as you suspect. For the untyped lambda-calculus, alpha-equivalence of beta-eta normal forms is the same as observational equivalence. Or put the other way

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Francesco Mazzoli
At Thu, 02 May 2013 20:47:07 +0100, Ian Price wrote: I know this isn't perhaps the best forum for this, but maybe you can give me some pointers. Earlier today I was thinking about De Bruijn Indices, and they have the property that two lambda terms that are alpha-equivalent, are expressed in

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Francesco Mazzoli
At Thu, 02 May 2013 23:16:45 +0200, Timon Gehr wrote: Yes, they can. Take ‘f = λ x : ℕ → x + x’ and ‘g = λ x : ℕ → 2 * x’. Those are not lambda terms. How are they not lambda terms? Furthermore, if those terms are rewritten to operate on church numerals, they have the same unique normal

Re: [Haskell-cafe] Lambda Calculus question on equivalence

2013-05-02 Thread Francesco Mazzoli
At Fri, 03 May 2013 00:44:09 +0200, Timon Gehr wrote: On 05/02/2013 11:33 PM, Francesco Mazzoli wrote: At Thu, 02 May 2013 23:16:45 +0200, Timon Gehr wrote: Yes, they can. Take ‘f = λ x : ℕ → x + x’ and ‘g = λ x : ℕ → 2 * x’. Those are not lambda terms. How are they not lambda

Re: [Haskell-cafe] Looking for portable Haskell or Haskell like language

2013-04-27 Thread Francesco Mazzoli
At Fri, 26 Apr 2013 21:21:48 -0800, Christopher Howard wrote: Hi. I've got this work situation where I've got to do all my work on /ancient/ RHEL5 systems, with funky software configurations, and no root privileges. I wanted to install GHC in my local account, but the gnu libc version is so

Re: [Haskell-cafe] Operations on functional graphs

2013-04-27 Thread Francesco Mazzoli
At Wed, 24 Apr 2013 13:02:39 +0100, Francesco Mazzoli wrote: Hi list, I’ve been lately thinking about how to implement an algorithm efficiently, and I need a directed graph that can perform the following tasks: 1. Finding the strongly connected components 2. Condensing strongly

Re: [Haskell-cafe] pattern matching on data families constructors

2013-04-25 Thread Francesco Mazzoli
At Thu, 25 Apr 2013 20:29:16 +0400, Alexey Egorov wrote: I'm curious - why data families constructors (such as DInt and DBool) doesn't imply such constraints while typechecking pattern matching? I think you are misunderstanding what data families do. ‘DInt :: DInt - D Int’ and ‘DBool :: DBool

Re: [Haskell-cafe] pattern matching on data families constructors

2013-04-25 Thread Francesco Mazzoli
At Thu, 25 Apr 2013 19:08:17 +0100, Francesco Mazzoli wrote: ... ‘DInt :: DInt - D Int’ and ‘DBool :: DBool - D Bool’ ... This should read ‘DInt :: Int - D Int’ and ‘DBool :: Bool - D Bool’. Francesco ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] pattern matching on data families constructors

2013-04-25 Thread Francesco Mazzoli
At Thu, 25 Apr 2013 19:08:17 +0100, Francesco Mazzoli wrote: Would you expect this to work? newtype DInt a = DInt a newtype DBool a = DBool a type family D a type instance D Int = DInt Int type instance D Bool = DBool Bool a :: D a - a a (DInt x) = x a (DBool x) = x

Re: [Haskell-cafe] pattern matching on data families constructors

2013-04-25 Thread Francesco Mazzoli
At Fri, 26 Apr 2013 00:20:36 +0400, Alexey Egorov wrote: Yes, my question is about why different instances are different types even if they have the same type constructor (D). I'm just find it confusing that using GADTs trick it is possible to match on different constructors. See it this way:

[Haskell-cafe] Operations on functional graphs

2013-04-24 Thread Francesco Mazzoli
Hi list, I’ve been lately thinking about how to implement an algorithm efficiently, and I need a directed graph that can perform the following tasks: 1. Finding the strongly connected components 2. Condensing strongly connected components 3. Contract single edges The condensing shouldn’t

Re: [Haskell-cafe] Word8 literals in ByteString haddock?

2013-03-27 Thread Francesco Mazzoli
At Wed, 27 Mar 2013 00:50:21 +, Niklas Hambüchen wrote: Hey, according to http://hackage.haskell.org/packages/archive/bytestring/0.10.2.0/doc/html/Data-ByteString.html#v:split I can write: split '\n' a\nb\nd\ne Can I really do that? I don't know of a way to make a '\n' literal be a

Re: [Haskell-cafe] Type checking the content of a string

2013-02-22 Thread Francesco Mazzoli
At Fri, 22 Feb 2013 19:43:51 +0100, Corentin Dupont wrote: Hi Adam, that looks interresting. I'm totally new to TH and QuasiQuotes, though. Can I run IO in a QuasiQuoter? I can run my own interpreter. Yes, you can:

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread Francesco Mazzoli
At Wed, 13 Feb 2013 15:32:57 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Francesco, I can confirm that 1.11.1 works. I think I fixed this problem. Would you try the master branch? https://github.com/kazu-yamamoto/ghc-mod Hi Kazu, Now I get another error: Error:command line:

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread Francesco Mazzoli
At Wed, 13 Feb 2013 19:51:15 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Now I get another error: Error:command line: cannot satisfy -package wl-pprint even if ‘wl-pprint’ is installed, and ‘cabal configure; cabal build’ runs fine. It seems to me that you installed multiple

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread Francesco Mazzoli
At Wed, 13 Feb 2013 22:01:35 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Nope :). I have one ‘ghc’, and this is my ‘ghc-pkg list’: http://hpaste.org/82293. ‘ghci -package wl-pprint’ runs just fine. Uhhhm. Are you using sandbox? Actually it turns out that I have a ‘cabal-dev’ directory

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-13 Thread Francesco Mazzoli
At Wed, 13 Feb 2013 13:24:48 +, Francesco Mazzoli wrote: At Wed, 13 Feb 2013 22:01:35 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Nope :). I have one ‘ghc’, and this is my ‘ghc-pkg list’: http://hpaste.org/82293. ‘ghci -package wl-pprint’ runs just fine. Uhhhm. Are you using

[Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
Hi, I have been using ghc-mod for a long time and I can’t give it up now, but I have an annoying problem. When I have a cabal file with a library and an executable depending on the library (for example here https://github.com/bitonic/kant/blob/master/kant.cabal), ghc-mod is not happy,

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 11:11:06 +0100, CJ van den Berg wrote: Hi Francesco, To keep ghc-mod happy, you also have to keep ghci happy. What you probably need is a .ghci file in the directory with a :set -isrc line in it. You may also need to add other stuff to .ghci such as language extensions

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 11:39:19 +0100, CJ van den Berg wrote: I downloaded your package and tried it. It does work. So, what I have is bitonic@clay ~/src/kant (git)-[master] % cat .ghci :set -isrc And I still get the mentioned error. Did you take any other measures to make things work?

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 21:22:23 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: I guess you don't install the kant library, right? If so, I will think how to treat this kind problem. The ‘kant’ package is the package I’m developing and using ghc-mod on. It includes both a library and an executable.

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 12:50:47 +0100, CJ van den Berg wrote: On 08/02/13 12:25, Francesco Mazzoli wrote: At Fri, 08 Feb 2013 11:39:19 +0100, CJ van den Berg wrote: I downloaded your package and tried it. It does work. So, what I have is bitonic@clay ~/src/kant (git)-[master

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 22:18:20 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: The ‘kant’ package is the package I’m developing and using ghc-mod on. Yes. I understand it. It includes both a library and an executable. The executable target has ‘kant’ as a dependency. What I asked is

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 22:39:07 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Well installing it has the big problem that each time I make a change to the interface I have to manually re-install, and this happens often since I’m in an early stage... I'm not saying that you should install it.

Re: [Haskell-cafe] ghc-mod and cabal targets

2013-02-08 Thread Francesco Mazzoli
At Fri, 08 Feb 2013 13:43:12 +, Francesco Mazzoli wrote: At Fri, 08 Feb 2013 22:39:07 +0900 (JST), Kazu Yamamoto (山本和彦) wrote: Well installing it has the big problem that each time I make a change to the interface I have to manually re-install, and this happens often since I’m

[Haskell-cafe] Inference for RankNTypes

2013-01-02 Thread Francesco Mazzoli
Hi list, I am a bit puzzled by the behaviour exemplified by this code: {-# LANGUAGE RankNTypes #-} one :: (forall a. a - a) - b - b one f = f two = let f = flip one in f 'x' id three = (flip one :: b - (forall a. a - a) - b) 'x' id four = flip one 'x' id Try to guess

Re: [Haskell-cafe] Inference for RankNTypes

2013-01-02 Thread Francesco Mazzoli
At Wed, 02 Jan 2013 12:32:53 +0100, Francesco Mazzoli wrote: Hi list, I am a bit puzzled by the behaviour exemplified by this code: {-# LANGUAGE RankNTypes #-} one :: (forall a. a - a) - b - b one f = f two = let f = flip one in f 'x' id three = (flip one :: b

Re: [Haskell-cafe] Inference for RankNTypes

2013-01-02 Thread Francesco Mazzoli
At Wed, 2 Jan 2013 14:49:51 +0200, Roman Cheplyaka wrote: I don't see how this is relevant. Well, moving `flip one' in a let solves the problem, and The fact that let-bound variables are treated differently probably has a play here. I originally thought that this was because the quantifications

Re: [Haskell-cafe] Inference for RankNTypes

2013-01-02 Thread Francesco Mazzoli
At Wed, 2 Jan 2013 11:20:46 -0500, Dan Doel wrote: Your example doesn't work for the same reason the following doesn't work: id runST (some st code) It requires the inferencer to instantiate certain variables of id's type to polymorphic types based on runST (or flip's based on one),

Re: [Haskell-cafe] Inference for RankNTypes

2013-01-02 Thread Francesco Mazzoli
At Wed, 2 Jan 2013 13:35:24 -0500, Dan Doel wrote: If you want to know the inner workings, you probably need to read the OutsideIn(X) paper.* I'm not that familiar with the algorithm. But what happens is something like this When GHC goes to infer the type of 'f x' where it knows that

Re: [Haskell-cafe] Motion to unify all the string data types

2012-11-12 Thread Francesco Mazzoli
At Mon, 12 Nov 2012 11:21:42 +0800, John Lato wrote: Speaking as the ListLike maintainer, I'd like this too. But it's difficult to do so without sacrificing performance. In some cases, sacrificing *a lot* of performance. So they have to be class members. However, there's no reason

Re: [Haskell-cafe] Motion to unify all the string data types

2012-11-12 Thread Francesco Mazzoli
At Mon, 12 Nov 2012 10:26:01 +, Francesco Mazzoli wrote: Interesting. Are we sure that we can't convince GHC to inline the functions with enough pragmas? Inline and SPECIALIZE :). Francesco. ___ Haskell-Cafe mailing list Haskell-Cafe

Re: [Haskell-cafe] Motion to unify all the string data types

2012-11-10 Thread Francesco Mazzoli
At Sat, 10 Nov 2012 15:16:30 +0100, Alberto G. Corona wrote: There is a ListLike package, which does this nice abstraction. but I don't know if it is ready for and/or enough complete for serious usage. I´m thinking into using it for the same reasons. Anyone has some experiences to share

Re: [Haskell-cafe] [Security] Put haskell.org on https

2012-10-28 Thread Francesco Mazzoli
At Sun, 28 Oct 2012 00:20:16 +0100, Niklas Hambüchen wrote: (I have mentioned this several times on #haskell, but nothing has happened so far.) Are you aware that all haskell.org websites (hackage, HaskellWiki, ghc trac) allow unencrypted http connections only? This means that everyone in

Re: [Haskell-cafe] [Security] Put haskell.org on https

2012-10-28 Thread Francesco Mazzoli
At Sun, 28 Oct 2012 14:59:00 +0400, Dmitry Vyal wrote: Does hackage at least store the logs of packages uploads? What's the reason or such a security model? I guess it was appropriate in the past when hackage was an experimental service, but now it's a standard way of distributing Haskell

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Fri, 28 Sep 2012 18:33:23 -0700, Alexander Solla wrote: Only with respect to type inference. I don't understand this comment. I wouldn't have replied with that line of thought if you had just told us what the problem was in the first place. I /was/ saying that you can use explicit type

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 10:30:07 +0200, Francesco Mazzoli wrote: Then I'd also like to have newtype TST sym algo = ... instance (Ord sym, ListLike full sym) = Search (TST sym algo) full algo This one is a different problem - it requires UndecidableInstances and I don't understand

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 13:04:59 +0400, MigMit wrote: Well, it seems that you can't do exactly what you want. So, the simplest way to do this would be not to make Foo a superclass for Bar: class Bar a where foo :: Foo a b = a - b - c Then you would have to mention Foo everywhere. Just to

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 10:56:29 +0200, Francesco Mazzoli wrote: At Sat, 29 Sep 2012 10:30:07 +0200, Francesco Mazzoli wrote: Then I'd also like to have newtype TST sym algo = ... instance (Ord sym, ListLike full sym) = Search (TST sym algo) full algo This one

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 19:49:36 +0200, Gábor Lehel wrote: I was browsing the GHC bug tracker and accidentally might have found a solution to your problem: http://hackage.haskell.org/trac/ghc/ticket/7100 Thanks, this makes me feel better. What interested me is not the workarounds, that I had

[Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
I would expect this to work, maybe with some additional notation (a la ScopedTypeVariables) {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} class Foo a b | a - b class Foo a b = Bar a where foo :: a - b - c The type family equivalent works

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
CCing the list back. At Fri, 28 Sep 2012 13:30:52 -0700, Alexander Solla wrote: What is the problem, exactly? It looks to me like UndecidableInstances and ScopedTypeVariables (on foo, or its arguments) would be enough. I'm not sure what you mean. I don't see the need for

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
At Fri, 28 Sep 2012 17:19:36 -0700, Alexander Solla wrote: Well, then what exactly is the problem? Are you getting an error? ...well yes. The error I get with the posted class declarations is Not in scope: type variable `b' at the line with class Foo a b = Bar a where Which I get

Re: [Haskell-cafe] Either Monad and Laziness

2012-09-12 Thread Francesco Mazzoli
At Wed, 12 Sep 2012 12:04:31 -0300, Eric Velten de Melo wrote: It would be really awesome, though, if it were possible to use a parser written in Parsec with this, in the spirit of avoiding code rewriting and enhancing expressivity and abstraction. There is

[Haskell-cafe] Haskell master thesis project

2012-08-20 Thread Francesco Mazzoli
Hi list(s), I've been hooked on Haskell for a while now (some of you might know me as bitonic on #haskell), and I find myself to decide on a project for my masters thesis. Inspired by the David Terei's master thesis (he wrote the LLVM backend), I was wondering if there were any projects

Re: [Haskell-cafe] lambdabot-4.2.3.3

2012-07-18 Thread Francesco Mazzoli
At Wed, 18 Jul 2012 15:14:47 +0400, Dmitry Malikov wrote: A few days ago I tried to install lambdabot package from hackage (4.2.3.2). Cabal install failed. Then I found DanBurton's github repo with some approaches to make lambdabot install fixed. All dependency packages (IOSpec, numbers)

Re: [Haskell-cafe] lambdabot-4.2.3.3

2012-07-18 Thread Francesco Mazzoli
At Wed, 18 Jul 2012 11:04:17 -0400, Cale Gibbard wrote: Lambdabot doesn't have a maintainer. So is it just orphaned and anyone can upload? That does not sound right, also considering that lambdabot is used on the IRC channel, it'd be nice to have a more structured way to push fixes and

Re: [Haskell-cafe] Is there a GHC flag that will allow mutable top level state while you are debugging and then ...

2012-07-05 Thread Francesco Mazzoli
At Wed, 4 Jul 2012 09:06:32 -0700, KC wrote: you can turn the flag off when you are ready to do the computational heavy lifting so that you don't have to modify your code base? That is, GHC can then apply its algebraic transformation optimizations to the code algebra of the pure functions.

Re: [Haskell-cafe] arbitrary rank polymorphism and ghc language pragmas

2012-07-05 Thread Francesco Mazzoli
At Thu, 05 Jul 2012 11:18:00 -0400, rickmurphy wrote: data T = TC (forall a b. a - b - a) The type of `TC' will be `(forall a b. a - b - a) - T', a Rank-2 type. -- Francesco * Often in error, never in doubt ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Francesco Mazzoli
At Thu, 21 Jun 2012 10:11:24 +0100 (BST), Rouan van Dalen wrote: Hi everyone, Can anyone shed some light on why the succ and pred functions of the Enum typeclass throw exceptions if we go over the upper or lower boundary, and not return Maybe a? I was hoping to have some functions like:

Re: [Haskell-cafe] darcs patch dependencies in dot format

2012-05-13 Thread Francesco Mazzoli
On 13/05/12 14:55, Sönke Hahn wrote: Somehow related questions are: What am I going to do with a dot-graph, that has more than 500 vertices? Is there an intelligent way to reduce the graph? Setting the `concentrate' parameter to true helps, but dot does not work well with massive graphs.

Re: [Haskell-cafe] darcs patch dependencies in dot format

2012-05-13 Thread Francesco Mazzoli
On 13/05/12 15:13, Francesco Mazzoli wrote: On 13/05/12 14:55, Sönke Hahn wrote: Somehow related questions are: What am I going to do with a dot-graph, that has more than 500 vertices? Is there an intelligent way to reduce the graph? Setting the `concentrate' parameter to true helps, but dot

[Haskell-cafe] bytestring, array and Safe Haskell

2012-05-08 Thread Francesco Mazzoli
Why are http://hackage.haskell.org/packages/archive/bytestring/0.9.2.1/doc/html/Data-ByteString-Unsafe.html and http://hackage.haskell.org/packages/archive/array/0.4.0.0/doc/html/Data-Array-Unsafe.html Safe-inferred? The first one uses inlinePerformIO, so it clearly shouldn't be marked as

Re: [Haskell-cafe] bytestring, array and Safe Haskell

2012-05-08 Thread Francesco Mazzoli
On 08/05/12 21:45, Austin Seipp wrote: The reasoning is outlined in the user manual here: http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/safe-haskell.html#safe-inference Yes, I was looking at that while writing that message. Mine wasn't that much a complaint regarding the wrong

Re: [Haskell-cafe] Fixed point newtype confusion

2012-05-06 Thread Francesco Mazzoli
Hi, In these cases is good to define smart constructors, e.g.: data E e = Lit Int | Add e e data Fix f = Fix {unFix :: f (Fix f)} type Expr = Fix E lit :: Int - Expr lit = Fix . Lit add :: Expr - Expr - Expr add e1 e2 = Fix (Add e1 e2) term :: Expr term = add (lit 1) (add (lit 2)

Re: [Haskell-cafe] Fixed point newtype confusion

2012-05-06 Thread Francesco Mazzoli
Sorry, I think I misunderstood your question, if I understand correctly you want some function to convert nested Expr to Fix'ed Exprs. You can do that with a typeclass, but you have to provide the Fix'ed type at the bottom: -- {-# LANGUAGE

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-10 Thread Francesco Mazzoli
On 10/04/12 07:28, Karel Gardas wrote: On 04/ 9/12 01:03 AM, Francesco Mazzoli wrote: No, it is not possible to build GHC without GHC. Building GHC on ARM is going to be extremely tricky (I'm not sure anyone has ever done it). It's not that tricky at the end. Just install LLVM 3.0 and some OS

Re: [Haskell-cafe] building ghc on arch linux ARM?

2012-04-08 Thread Francesco Mazzoli
No, it is not possible to build GHC without GHC. Building GHC on ARM is going to be extremely tricky (I'm not sure anyone has ever done it). What you should be able to do easily with the next release is cross-compile to ARM through the LLVM backend. Francesco. On 08/04/12 23:28, . wrote:

Re: [Haskell-cafe] The (!) operation

2012-03-08 Thread Francesco Mazzoli
On 08/03/12 16:19, Christopher Done wrote: ‘Ello. Is there a generalization of this operator? It's all over the place, it's basically (!) :: (Monad m, Indexed collection index value) = index - container - m value We have `(!!)` on lists, `(!)` on maps, vectors, json objects, … (doesn't

Re: [Haskell-cafe] The (!) operation

2012-03-08 Thread Francesco Mazzoli
Ops sorry, I had misunderstood, you don't want key-lookups but a simple indexing. In that case you might want an almost identical class but with different instances (e.g IxClass [a] Int a, etc.). Also, I don't see why you need to throw monads in. Francesco.

Re: [Haskell-cafe] The (!) operation

2012-03-08 Thread Francesco Mazzoli
Ok, this should suit your needs better, without functional dependencies as a bonus: {-# LANGUAGE TypeFamilies, ScopedTypeVariables, FlexibleInstances #-} module IxClass (IxClass(..)) where import Data.Map (Map) import qualified Data.Map as Map import Data.Hashable (Hashable) import

Re: [Haskell-cafe] The (!) operation

2012-03-08 Thread Francesco Mazzoli
(Though I seem to recall the monadic return value being frowned upon but I don't recall why.) The type signature that you wrote is very generic and doesn't help in introducing effects while retrieving the indexed value, which I imagine is what you wanted to do. I guess you could define a

Re: [Haskell-cafe] The (!) operation

2012-03-08 Thread Francesco Mazzoli
Because Maybe is already a monad and it's nice to fail in the monad of choice, e.g. if I'm in the list monad I get empty list instead, or if I'm in the Result monad from JSON it'll fail in there. ‘Course fail is suboptimal and MonadError might be better. 'fail' really shouldn't be in Monad. My

Re: [Haskell-cafe] Data.Map: Values to keys and keys to values

2011-06-16 Thread Francesco Mazzoli
On 16/06/11 15:01, Dmitri O.Kondratiev wrote: Hi, Data.Map has many great functions, yet I could not find the one that allows from one map create another map where keys are values and values are keys of the first one. Something like: transMap:: (Ord k, Ord a) = Map k a - Map a k Does such

Re: [Haskell-cafe] Loading bitmap with xlib

2011-02-02 Thread Francesco Mazzoli
Conrad Parker conrad at metadecks.org writes: On 31 January 2011 21:40, Francesco Mazzoli f at mazzo.li wrote: Francesco Mazzoli f at mazzo.li writes: At the end I gave up and I wrote the function myself: http://hpaste.org/43464/readbitmapfile cool ... the listed maintainer

Re: [Haskell-cafe] Loading bitmap with xlib

2011-01-31 Thread Francesco Mazzoli
Francesco Mazzoli f at mazzo.li writes: At the end I gave up and I wrote the function myself: http://hpaste.org/43464/readbitmapfile ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Loading bitmap with xlib

2011-01-29 Thread Francesco Mazzoli
I am trying to load a bitmap and display it with the Xlib bindings, but I wasn't able to find a way. The C Xlib functions would be XReadBitmapFile() of XReadBitmapFileData() to read the data, but it seems that those functions haven't been included in the haskell bindings. From