Hi,
You can make a datatype that captures exactly the expressions you want (see
code below). Essentially you want to make sure that a subtraction or
addition never has another subtraction or addition as its left operand.
I would also like to advertise a bit and show how this type can be
Hi,
Short question: can I or someone else make the Hackage build bot
rebuild a package with a new dependency (even though the initial build
was successful)?
Long question:
Does anyone know what would cause the documentation of a successful
Hackage build not to appear on the web? Specifically I'm
Hi,
I suppose you need to define what commutativity means in the presence
of undefined values. For instance if error 0 is different from error
1 then you do not have commutativity. Also nontermination needs to
be considered, for instance (fix $ \x-x) == undefined typically
fails to terminate but
HI Jacques,
This looks very similar to the recently released testing-feat library:
http://hackage.haskell.org/package/testing-feat-0.2
I get a build error on the latest platform:
Test\GenCheck\Base\LabelledPartition.lhs:126:3:
The equation(s) for `new' have two arguments,
but its type
Its a bug in haskell-src-meta. I just reported it:
https://github.com/benmachine/haskell-src-meta/issues/8
Regards,
Jonas
On 1 September 2011 03:19, bob zhang bobzhang1...@gmail.com wrote:
Hi, all
parseExp (,) 3 4 =
Right (AppE (AppE (ConE GHC.Unit.(,)) (LitE (IntegerL 3))) (LitE
There is the void function in Control.Monad:
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:void
Instead of using return () you can just use void processLine.
Also some people like to use the either function instead of matching on
Left/Right. In this case
Shuffle [1..20], then take 5?
Yes, so simple, I'm embarrassed I didn't think of it.
That works well for small numbers, but I'm guessing it will evaluate the
entire list so it should not be used for large inputs. If you have a large
interval and use a relatively small part of it, the following
That's a useful operator! Unfortunately it does not play nice with $. Of
less importance: some syntactic constructs can not appear in the arguments
without parenthesis, let bindings for instance (although lambda abstraction
works parenthesis-free).
Also I'm not sure this can be used for defining
Hi,
Would it be possible to allow this in Haskell (where applied to is some
new operator or keyword):
f applied to {x a;y b;z c}
As an equivalent to:
f (x a) (y b) (z c)
Of course my intention is that the new keyword should initiate layout syntax
so we can write this:
f applied to
x a
y
I don't see the similarity (from reading this:
http://www.haskell.org/haskellwiki/Idiom_brackets). My suggestion is
just a way of using layout to avoid parenthesis.
/J
2011/5/25 Brandon Allbery allber...@gmail.com:
2011/5/25 Jonas Almström Duregård jonas.dureg...@chalmers.se
Would
May 2011 22:06, Alexander Solla alex.so...@gmail.com wrote:
2011/5/25 Jonas Almström Duregård jonas.dureg...@chalmers.se
I don't see the similarity (from reading this:
http://www.haskell.org/haskellwiki/Idiom_brackets). My suggestion is
just a way of using layout to avoid parenthesis
Hi,
Is there something wrong with the Hackage build system?
It fails to build BNFC-meta: http://hackage.haskell.org/package/BNFC-meta
It complains about a missing dep even though it (the dependency) has
been built successfully. Also the dependencies are exactly the same as
in the previous
Depending on your concrete syntax, you may be able to use BNFC
(http://hackage.haskell.org/package/BNFC).
/J
On 26 January 2011 17:22, Ozgur Akgun ozgurak...@gmail.com wrote:
Dear Café,
I working on a DSL represented by a algebraic data type with many
constructors. I can write (separately) a
Hi,
But TH gives me the same feeling as other language features that have
been described as bolted on. Also, TH is both library and built-in
syntax (via an extension) which feels strange to me.
I don't understand why the library/extension duality is a problem. I would
say that the best
Hi Henning,
I also think that Template Haskell is used too much. Several
things that are done in existing libraries could be done in plain
Haskell in a better way.
Can you give any examples of this? I'm not saying it's not true, I'm just
curious as to why you would venture into the realm of
Maybe this one:
http://hackage.haskell.org/platform/2010.2.0.0/HaskellPlatform-2010.2.0.0-setup.exe
/J
On 22 December 2010 17:15, Aaron Gray aaronngray.li...@gmail.com wrote:
Could someone please point me at a copy of the latest Haskell platform or a
working GHC please.
Many thanks in
Unless you have a 'real' type for parse sometime during compile time, TH
won't be able to generate it. A good rule of thumbs is that if you can't
write the code yourself, then you can't get TH to do it either.
/J
On 27 October 2010 08:50, Andy Stewart lazycat.mana...@gmail.com wrote:
Serguey
Regardless, 7zip (LGPL) can do it. But you have to first inzip, and then
untar as a seperate step.
This is pretty far off topic, but you can actually unpack it in a single
run. If you use the GUI version of 7z (a.k.a. the 7zip File Manager) you can
open the .tar.gz and it will list a single .tar
Hi Gregory,
What can i do with the list i get from join (TaggedList (Plus m n))? I can't
use head or tail on it... Maybe something like:
shiftl :: TaggedList (Plus (SuccessorTo m) n) - TaggedList (SuccessorTo
(Plus m n))
I'm still not sure there's an actual case where it's useful... You could
I just noticed Plus is a type family and not a type :), ignore my previous
comment. Nice library!
/J
2010/10/14 Jonas Almström Duregård jonas.dureg...@chalmers.se
Hi Gregory,
What can i do with the list i get from join (TaggedList (Plus m n))? I
can't use head or tail on it... Maybe
So all you need is a program that checks if your functions terminate. How
hard can it be, right? ;) Seriously though, since you would need static
termination guarantees on all functions that produce lists, you will
be severely restricted when working with them. It's like Haskell without
general
Nice, but how about a list destructor
I'm not sure what you mean by destructor, if you mean an eliminator for
case analysis then you can make a function
finite :: b - (a - Finite s1 a - b) - Finite s2 a - b
finite b _ (Finite []) = b
finite _ f (Finite (x:xs)) = f x xs
If you men functions
Jonas,
2010/10/13 Jonas Almström Duregård jonas.dureg...@chalmers.se
(++) :: Finite s1 a - Finite s2 a - Finite (S (Plus s1 s2)) a
(++) (Finite a) (Finite b) = Finite $ a Prelude.++ b
infixr 5 ++
Why do you have the S in the return type of Finite.++ ?
Ozgur
Hi Stephen,
I'm not sure I see the problem. You can do what you require with the
function i supplied (minus the typo). This is in the module (where the
Finite constructor is exposed)
finite :: b - (a - Finite s a - b) - Finite s a - b
finite b _ (Finite []) = b
finite _ f (Finite (x:xs)) = f
...and you can always do
hack :: Vec n a - FixedVec a
hack x :: FixedVec undefined
Also I'm guessing 1, 2 and 17 are just examples, he really wants arbitrary
length finite lists.
/J
On 13 October 2010 20:47, Daniel Peebles pumpkin...@gmail.com wrote:
One option could be something like:
Hi Café,
I'm doing some code generation with Template Haskell that results in
few hundred top level declaration, of which only 10 or so should
actually be exposed to the user (the rest are only used by generated
code).
Since I cant splice stuff into the module header (i.e. into the export
list),
HackageDB reports a build failure for happy-meta-0.1.1
(http://hackage.haskell.org/package/happy-meta-0.1.1), but from the
log it seems that the failure occurs when building the documentation.
The error is
src/LALR.lhs:230:2: parse error on input `numberSets'
I'm guessing there is no syntax
I'm pleased to announce alex-meta and happy-meta! These libraries provide
quasi-quoter frontends and Template Haskell backends to the Alex lexer
generator and the Happy parser generator respectively. Usage is something
like this:
{-# Language QuasiQuotes #-}
module LexParse where
import
I'm pleased to announce BNFC-meta-0.1.0!
BNFC-meta can take a quasi-quoted LBNF grammar (as used by the BNF
Converter) representation of a language and generate (using Template
Haskell) a number of wonderful tools for dealing with this language,
including:
* Abstract syntax types
* Lexer
* LALR
The type (String - Maybe (a, String)) should already be an instance of
arbitrary if a is.
One way of generating functions is to have some sort of hashing function (a
- Int). Functions from a to b can be generating by using the hash value to
transform the random seed before the b is generated.
#define defObj(t) newtype t = t Obj deriving (A,B,C,D)
Blasphemy! :)
On 14 September 2010 23:01, John Meacham j...@repetae.net wrote:
On Tue, Sep 14, 2010 at 01:24:16AM -0700, Kevin Jardine wrote:
I have a set of wrapper newtypes that are always of the same format:
newtype MyType =
Now, you say it's preferable to use the native package manager where
possible. I've got one word for you: Windows. You know, the most popular OS
on the market? The one installed on 98% of all computers world-wide? Guess
what: no native package manager.
Isn't Windows Installer (MSI) a package
-meta with the correct dependencies (TH2.4)?
2010/8/17 Ben Millwood hask...@benmachine.co.uk:
2010/8/17 Jonas Almström Duregård jonas.dureg...@gmail.com:
Hi,
Has there been any progress with this package? Like you I have also
tried to contact Matt and like you I have ended up making my own
Hi,
Has there been any progress with this package? Like you I have also
tried to contact Matt and like you I have ended up making my own
version of src-meta :). When someone assumes maintainership of this
package I would like to discuss integrating some additions I made to
the Translation module.
Hi,
I cannot write classes that see into internal structure. For example,
I cannot write my own (de)serialization without using from/toAscList.
Actually I don't believe you can do this with TH either. TH splices
code into the module where you use it. The generated code is then type
checked in
Hi John,
As for the academic requirements, try formulating a question which is
answered by the program you write, for instance:
Is it possible to write an efficient [YOUR PROJECT] in a purely
functional setting?
Can the advantages of [PORTED UTILITY] be utilized without relying on
code with
For some reason the generate function is not in QC2.
Here's a quick fix:
\begin{code}
import Test.QuickCheck.Gen
import System.Random
generate :: Int - StdGen - Gen a - a
generate n rnd (MkGen m) = m rnd' size
where
(size, rnd') = randomR (0, n) rnd
\end{code}
Perhaps it would be better
For some reason the generate function is not in QC2.
Here's a quick fix:
\begin{code}
import Test.QuickCheck.Gen
import System.Random
generate :: Int - StdGen - Gen a - a
generate n rnd (MkGen m) = m rnd' size
where
(size, rnd') = randomR (0, n) rnd
\end{code}
Perhaps it would be better
One might expect a == (a/b)*b and other common arithmetic formulas to
hold for division?
/Jonas
On 31 May 2010 14:32, Maciej Piechotka uzytkown...@gmail.com wrote:
I started to wonder what is the difference between div and / so they are
2 separate symbols.
div:
Take a Integral divide and
, Daniel Fischer daniel.is.fisc...@web.de wrote:
On Tuesday 01 June 2010 20:26:55, Jonas Almström Duregård wrote:
One might expect a == (a/b)*b and other common arithmetic formulas to
hold for division?
/Jonas
Better not if one's using Float or Double
It might be useful to relax the type of the function to
Monad m = (a - b - c) - m a - m b - m c
/Jonas
On 30 May 2010 10:35, Michael Vanier mvanie...@gmail.com wrote:
I stumbled across this monadic combinator:
mcombine :: Monad m = (a - a - a) - m a - m a - m a
mcombine f mx my = do
x -
Consider that calling
id undefined
requires evaluating undefined before you can call id. The program will
crash before you ever call id. Of course, the identity function should
have produced a value that crashed in exactly the same way. But we never got
there.
In which sense does id need
Note that all (True ==) is logically equivalent to all id and to
the and function from the prelude.
A more general approach based on type classes, the function taut takes
a boolean function and determines (by exhaustive search) if it is a
tautology:
class BooleanFunction a where
taut :: a -
An easier way of demonstrating this issue:
Prelude [3,7..22]::[Int]
[3,7,11,15,19]
Prelude [3,7..22]::[Double]
[3.0,7.0,11.0,15.0,19.0,23.0]
/Jonas
On 8 May 2010 09:47, Malcolm Wallace malcolm.wall...@cs.york.ac.uk wrote:
Hugs [3,7..22]
[3,7,11,15,19] - OK
Hugs map (* 1.0) [3,7..22]
I don't think you can:
http://www.mail-archive.com/haskell-cafe@haskell.org/msg13057.html
I've also looked at the reify function in the latest version of TH and
there seems to be no way of reifying instances.
/Jonas
On 22 April 2010 22:33, Dmitry Olshansky olshansk...@gmail.com wrote:
Hello
and all datatype generic functions can piggy bag on the same TH
derivation. For example, look at Generics.Regular.Functions.Arbitrary, this
module is really concise.
Nice work though!
Gr,
Sebastiaan
On Apr 18, 2010, at 1:43 AM, Jonas Almström Duregård wrote:
I'm pleased to announce
...@gmail.com:
Wow, very cool! This is so helpful I'm surprised it isn't part of
QuickCheck. Why isn't it?
Regards,
Duane Johnson
On Apr 17, 2010, at 6:43 PM, Jonas Almström Duregård wrote:
{-#LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
import Test.AgataTH
data X a b = X [Either a b
If this is to be used with QuickCheck maybe it should be named that way.
Certainly worth considering. There seems to be no convenient way of
renaming packages on Hackage though, is there?
I suppose it would be wrong/impossible to create an alias package
(quickcheck-agata) with no modules, just a
I'm pleased to announce Agata (Agata Generates Algebraic Types Automatically)!
Avoiding excessive details, usage is best described by a small example:
{-#LANGUAGE TemplateHaskell #-}
import Test.QuickCheck
import Test.AgataTH
data X a b = X [Either a b] deriving Show
data Y = Y deriving Show
I guess nontermination is a problem (e.g. if one or both functions
fail to terminate for some values, equality will be undecidable).
/Jonas
On 14 April 2010 08:42, Ashley Yakeley ash...@semantic.org wrote:
On Wed, 2010-04-14 at 16:11 +1000, Ivan Miljenovic wrote:
but the only way you can prove
But if one did start considering bottom to be a value, one would have to
distinguish different ones. For instance, (error ABC) vs. (error
PQR). Obviously this is not finite.
Nor is it computable, since it must distinguish terminating programs
from nonterminating ones (i.e. the halting
...@gmail.com:
On 14 Apr 2010, at 09:01, Jonas Almström Duregård wrote:
But if one did start considering bottom to be a value, one would have to
distinguish different ones. For instance, (error ABC) vs. (error
PQR). Obviously this is not finite.
Nor is it computable, since it must
f,g :: Bool - Int
f x = 6
g x = 6
We can in Haskell compute that these two functions are equal, without solving
the halting problem.
what about these?
f,g :: Bool - Int
f x = 6
g x = x `seq` 6
/Jonas
2010/4/14 Thomas Davie tom.da...@gmail.com:
On 14 Apr 2010, at 09:01, Jonas Almström
= undefined
is not a problem?
/Jonas
2010/4/14 Thomas Davie tom.da...@gmail.com:
On 14 Apr 2010, at 09:12, Jonas Almström Duregård wrote:
f,g :: Bool - Int
f x = 6
g x = 6
We can in Haskell compute that these two functions are equal, without
solving the halting problem.
what about
Maybe users could choose between using a real name and being given a
random one (like AnonymousN). This will (1) protect from data
mining, (2) protect from government persecution and (3) keep the
damned 1337 Haxxor names away from Hackage :)
On 6 April 2010 08:02, Miguel Mitrofanov
Jonas Almström Duregård jonas.dureg...@gmail.com:
Maybe users could choose between using a real name and being given a
random one (like AnonymousN). This will (1) protect from data
mining, (2) protect from government persecution and (3) keep the
damned 1337 Haxxor names away from Hackage :)
I
In addition, the concept is rather silly, as one can just take a
pseudonym without any of us knowing:
When I registered I was prompted to verify my identity by means of my
university email (as opposed to my gmail account), which would
complicate using a pseudonym.
This being said, I have no
Sounds great!
Here are a few feature requests:
The I/O pair ([-1,4,-6],[1,4,6]) could yield map abs as a suggestion :)
The pairs ('a',False) and ('*',True) could yield not . isAlpha etc.
I realize that this (at least the composition part) will probably
increase complexity beyond what's
, Jonas Almström Duregård wrote:
I suppose you are already using the Haskell Platform?
I had problems with darcs freezing, and it turned out that the ssh
client was actually prompting for something. Is the host you are
connected to in your list of trusted hosts? Also i had a similar
problem when
I suppose you are already using the Haskell Platform?
I had problems with darcs freezing, and it turned out that the ssh
client was actually prompting for something. Is the host you are
connected to in your list of trusted hosts? Also i had a similar
problem when using Pageant to manage SSH-keys,
Hi Rafael,
I assume you will perform this operation on some very large lists, or
performance would not be an issue. Have you tested if your optimized
version is better than your initial one?
You should compare your implementation against something like this:
import qualified Data.Set as Set
Ertugrul: while your solution is minimalistic, Rafael deemed his
~n*log n implementation too inefficient. Thus your ~n^3 implementation
is hardly an improvement...
/Jonas
On 23 February 2010 13:03, Ertugrul Soeylemez e...@ertes.de wrote:
Rafael Gustavo da Cunha Pereira Pinto
Fischer daniel.is.fisc...@web.de wrote:
Am Dienstag 23 Februar 2010 13:59:49 schrieb Ertugrul Soeylemez:
Jonas Almström Duregård jonas.dureg...@gmail.com wrote:
Ertugrul: while your solution is minimalistic, Rafael deemed his
~n*log n implementation too inefficient. Thus your ~n^3 implementation
/clearer-reflection/
-Edward Kmett
2010/2/17 Jonas Almström Duregård jonas.dureg...@gmail.com
Hi,
This literate haskell file was intended to be a quick question about a
problem i have been pondering, but it developed into a short
presentation instead. What i want to know
- Related (x a x0) v
on2 = rerelate
on3 :: Related a v - Related (x a x0 x1) v
on3 = rerelate
on4 :: Related a v - Related (x a x0 x1 x2) v
on4 = rerelate
Regards,
Jonas Almström Duregård
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
65 matches
Mail list logo