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
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
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.
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
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
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
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
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
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
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
___
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
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
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
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
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
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
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
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
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
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:
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
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
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:
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:
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
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
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
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,
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
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?
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.
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
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
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.
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
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
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
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
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),
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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)
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
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.
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
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:
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.
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
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
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
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)
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
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
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:
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
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.
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
(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
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
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
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
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
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
77 matches
Mail list logo