Re: [Haskell-cafe] reifying typeclasses

2013-09-16 Thread Emil Axelsson
2013-09-15 11:16, o...@okmij.org skrev: Evan Laforge wrote: I have a typeclass which is instantiated across a closed set of 3 types. It has an ad-hoc set of methods, and I'm not too happy with them because being a typeclass forces them to all be defined in one place, breaking modularity. A

Re: [Haskell-cafe] mapFst and mapSnd

2013-05-28 Thread Emil Axelsson
`mapPair` also exists as `tup2` in patch-combinators: http://hackage.haskell.org/package/patch-combinators / Emil 2013-05-28 16:01, Andreas Abel skrev: See Agda.Utils.Tuple :-) -- | Bifunctoriality for pairs. (-*-) :: (a - c) - (b - d) - (a,b) - (c,d) (f -*- g) ~(x,y) = (f x, g y) -- |

Re: [Haskell-cafe] Why were datatype contexts removed instead of fixing them?

2013-04-25 Thread Emil Axelsson
2013-04-26 04:31, wren ng thornton skrev: On 4/25/13 9:49 PM, Dan Doel wrote: I don't really think they're worth saving in general, though. I haven't missed them, at least. The thing I've missed them for (and what I believe they were originally designed for) is adding constraints to derived

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-21 Thread Emil Axelsson
This should be possible using higher-order terms, as in http://hackage.haskell.org/packages/archive/compdata/latest/doc/html/Data-Comp-Multi-Term.html The only complication I see is that the Dag nodes would get heterogeneous types requiring existential quantification with a `Typeable`

Re: [Haskell-cafe] adding recursion to a DSL

2013-02-19 Thread Emil Axelsson
You probably don't need recursion in the DSL for this (that would require a way to detect cycles in the expressions). For this example, it looks like all you need is to add something like `map` as a DSL construct. Your example could perhaps be expressed as forEach (1,1000) (\n - out

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Emil Axelsson
2013-02-19 12:10, Anton Kholomiov skrev: I'm glad to announce the package for Commonsubexpression elimination [1]. It's an implementation of the hashconsig algorithm as described in the paper 'Implementing Explicit and Finding Implicit Sharing in EDSLs' by Oleg Kiselyov. Main point of the

Re: [Haskell-cafe] ANN: data-fix-cse -- Common subexpression elimination for EDSLs

2013-02-19 Thread Emil Axelsson
and lightweight. Just fixpoints, just folds and unfolds. 2013/2/19 Emil Axelsson e...@chalmers.se mailto:e...@chalmers.se 2013-02-19 12:10, Anton Kholomiov skrev: I'm glad to announce the package for Commonsubexpression elimination [1]. It's an implementation of the hashconsig

Re: [Haskell-cafe] catamorphisms and attribute grammars

2013-01-28 Thread Emil Axelsson
Patrick Bahr does something very similar in Modular Tree Automata [1], also noting the relation to attribute grammars. It's implemented in the compdata package [2]. [1] Patrick Bahr, Modular Tree Automata (MPC 2012), http://dx.doi.org/10.1007/978-3-642-31113-0_14 [2]

Re: [Haskell-cafe] sequential logic

2012-12-05 Thread Emil Axelsson
2012-12-06 01:16, Christopher Howard skrev: Hi. I was wondering what the various (and especially most simple) approaches one could take for working with (simulating or calculating) sequential logic in Haskell. By sequential logic, I mean like wikipedia describes, where a system is made up of

Re: [Haskell-cafe] AST Rewriting

2012-11-21 Thread Emil Axelsson
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

[Haskell-cafe] Parameterized constraints

2012-07-06 Thread Emil Axelsson
Hi! The `constraints` package provides ways to manipulate objects of kind `Constraint`. I need the same kind of manipulation, except that I need to work with objects of kind `* - Constraint`. I.e. I need parameterized constraints that can be applied to different types. BTW, is there a

Re: [Haskell-cafe] Using syntactic to implement the lambda calculus

2012-07-05 Thread Emil Axelsson
Hi Alex! 2012-07-03 20:18, Alex Rozenshteyn skrev: I'm trying to implement the lambda calculus (with CBV evaluation) using the syntactic package, in such a way that a simple extension is also simple to implement. I am stuck on the fact that it seems that the Value type needs to be parametrized

Re: [Haskell-cafe] Using Data Types a la Carte

2012-04-19 Thread Emil Axelsson
2012-04-19 22:31, Alex Rozenshteyn skrev: I'm trying to implement a set of languages with a large overlap between them. From what I understand, there are 3 main ways to do this: Finally Tagless, Data Types a la Carte, or manually. I'm currently leaning toward DTalaC, but not strongly. There

Re: [Haskell-cafe] partial type annotations

2012-01-19 Thread Emil Axelsson
In the spirit of Oleg's hack, but with nicer combinator support, you can use the patch combinators I just uploaded to Hackage (prompted by this thread): http://hackage.haskell.org/package/patch-combinators Your example then becomes: my_code_block = do x - instruction1 -:: tCon

[Haskell-cafe] Patch combinators

2012-01-16 Thread Emil Axelsson
Hi all! Based on ideas by Koen Claessen, I have made a small module for what might be called patch combinators: http://hpaste.org/56501 Examples are found as comments. Before I push this to Hackage, I just wanted to check if there is any package that already provides this sort of

Re: [Haskell-cafe] Disjunctive patterns

2011-12-08 Thread Emil Axelsson
Instead of pattern guards you can use ViewPatterns: http://hackage.haskell.org/trac/ghc/wiki/ViewPatterns This reduces some of the noise. {-# LANGUAGE ViewPatterns #-} data T = Foo Int | Bar Int | Baz fooBar (Foo a) = Just a fooBar (Bar a) = Just a fooBar _

Re: [Haskell-cafe] Putting constraints on internal type variables in GADTs

2011-11-08 Thread Emil Axelsson
2011-11-08 14:59, Felipe Almeida Lessa skrev: On Tue, Nov 8, 2011 at 11:49 AM, Anupam Jainajn...@gmail.com wrote: I can work around this by changing my data type declaration to include Show constraints but I don't want to restrict my data type to only Showable things just so I could have a

Re: [Haskell-cafe] library on common sub-expression elimination?

2011-08-15 Thread Emil Axelsson
2011-08-13 05:40, Levent Erkok skrev: On 8/12/2011 10:30 AM, Conal Elliott wrote: Note that data-reify will only find *some* common/equal sub-expressions, namely the pointer-equal ones. In all of my code-generating (deep) DSLs, it's been very important for efficiency to also pull out

Re: [Haskell-cafe] Haskell syntax highlighting in a public blog

2011-08-15 Thread Emil Axelsson
2011-08-09 03:54, Oscar Picasso skrev: Hi, Is there a public blog that that allow syntax highlighting of Haskell code? One option is to write the post in Markdown and use Pandoc (with syntax highlighting) to convert to HTML. The process (for Blogger) is described here:

[Haskell-cafe] ANN: syntactic-0.5

2011-07-28 Thread Emil Axelsson
I've just uploaded a new version of syntactic: http://hackage.haskell.org/package/syntactic The most important change is that I've added observable sharing based on StableNames. The implementation and interface are conceptually quite similar to Andy Gill's data-reify. The library offers

Re: [Haskell-cafe] How unique is Unique

2011-05-30 Thread Emil Axelsson
2011-05-28 11:35, Heinrich Apfelmus skrev: Emil Axelsson wrote: Hello! Lacking a proper blog, I've written some notes about Data.Unique here: http://community.haskell.org/~emax/darcs/MoreUnique/ This describes a real problem that makes Data.Unique unsuitable for implementing observable

[Haskell-cafe] How unique is Unique

2011-05-27 Thread Emil Axelsson
Hello! Lacking a proper blog, I've written some notes about Data.Unique here: http://community.haskell.org/~emax/darcs/MoreUnique/ This describes a real problem that makes Data.Unique unsuitable for implementing observable sharing. The document also proposes a solution that uses time

Re: [Haskell-cafe] How unique is Unique

2011-05-27 Thread Emil Axelsson
2011-05-27 10:44, David Virebayre skrev: 2011/5/27 Emil Axelssone...@chalmers.se: Does anyone have any comments on the proposed solution? Are there any alternatives available? It might be unsuitable where an administrator can change the system's time while the program is running. Agreed!

Re: [Haskell-cafe] How unique is Unique

2011-05-27 Thread Emil Axelsson
2011-05-27 13:12, Simon Marlow skrev: On 27/05/2011 08:35, Emil Axelsson wrote: Hello! Lacking a proper blog, I've written some notes about Data.Unique here: http://community.haskell.org/~emax/darcs/MoreUnique/ This describes a real problem that makes Data.Unique unsuitable for implementing

[Haskell-cafe] Cabal upload failure

2011-05-24 Thread Emil Axelsson
Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid or incomplete multibyte or wide character) In fact, I get the same error if I use the Check functionality on the earlier version

Re: [Haskell-cafe] Cabal upload failure

2011-05-24 Thread Emil Axelsson
2011-05-24 12:05, Niklas Broberg skrev: On 24 May 2011 19:48, Emil Axelsson e...@chalmers.se mailto:e...@chalmers.se wrote: Hello! I'm trying to upload a new version of syntactic, but Hackage gives the error: 500 Internal Server Error stdin: hWaitForInput: invalid argument (Invalid

[Haskell-cafe] Impossible class instance?

2011-05-16 Thread Emil Axelsson
Hello! At the end of this message is a program with a simple expression type, and a class `ToExpr` that generalizes expressions to arbitrary Haskell types. Every node in `Expr` is annotated with some abstract information. The program raises the following type error: test.hs:13:5:

Re: [Haskell-cafe] Impossible class instance?

2011-05-16 Thread Emil Axelsson
Ahh, never mind... I just realized there's no way to relate the `info` in the instance to the `info` in the class definition. Alright, I'll keep trying to make this work. Sorry for the noise! / Emil 2011-05-16 12:19, Emil Axelsson skrev: Hello! At the end of this message is a program

Re: [Haskell-cafe] [Haskell] ANN: syntactic-0.1

2011-05-10 Thread Emil Axelsson
2011-05-10 15:31, Heinrich Apfelmus skrev: I'm also unhappy about some of the boilerplate. For instance, have a look at the function goE in compileAccumB (line 210), it's just a generic applicative traversal through the data type. Most likely, this boilerplate could be simplified using

[Haskell-cafe] ANN: syntactic-0.1

2011-05-06 Thread Emil Axelsson
I'm happy to announce the first release of syntactic: http://hackage.haskell.org/package/syntactic providing generic abstract syntax and utilities for embedded languages. To get an idea of what it's about, check out the tiny(!) implementation of (simplified) Feldspar in the Examples

[Haskell-cafe] ANNOUNCE: New version Feldspar

2011-04-27 Thread Emil Axelsson
On behalf of the Feldspar team, I'm happy to announce version 0.4.0.2 of feldspar-language and feldspar-compiler: http://hackage.haskell.org/package/feldspar-language http://hackage.haskell.org/package/feldspar-compiler Feldspar is an embedded domain-specific language for generating code

[Haskell-cafe] Why does Cabal not choose the latest package?

2011-04-26 Thread Emil Axelsson
Hello! I've had some of the usual problems with packages depending on multiple versions of another package. It seems the root of the hole problem was that I once attempted to run cabal install cabal-install This brought in a number of older packages (Cabal-1.8.0.6, containers-0.3.0.0,

Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-23 Thread Emil Axelsson
2011-02-23 13:56, Victor Nazarov skrev: Also I think that value of hash functions is obviously a Monoid and it will be convenient to have Monoid instance newtype Hash = Hash Int instance Monoid Hash where mempty = Hash 0 Hash a `mappend` Hash b = Hash (a `combine` b)

Re: [Haskell-cafe] Is let special?

2010-11-02 Thread Emil Axelsson
Fundera på vad parentesen innebär. / Emil 2010-11-02 10:20, Max Bolingbroke skrev: To recover this sharing, you either need some sort of observable sharing, or some common subexpression elimination (which risks introducing space leaks if your DSL has lazy semantics).

Re: [Haskell-cafe] Is let special?

2010-11-02 Thread Emil Axelsson
Sorry, that was a mental note to myself :) / Emil 2010-11-02 12:41, Emil Axelsson skrev: Fundera på vad parentesen innebär. / Emil 2010-11-02 10:20, Max Bolingbroke skrev: To recover this sharing, you either need some sort of observable sharing, or some common subexpression elimination

Re: [Haskell-cafe] Re: Map constructor in a DSL

2010-10-28 Thread Emil Axelsson
2010-10-28 12:09, Dupont Corentin skrev: I'm also looking at the Atom's DSL to get inspiration. Something I don't understand in it is that it has two languages, on typed: data E a where VRef :: V a - E a Const:: a - E a Cast :: (NumE a, NumE b) = E a -

Re: [Haskell-cafe] EDSL for Makefile

2010-09-30 Thread Emil Axelsson
How about: execute (gcc -c ++ dependencyList ++ -o ++ target r1) / Emil 2010-09-30 10:41, C K Kashyap skrev: Also, I wanted some idea on how(in the current approach) I could make the target name and the dependency available to the action writer - as shown below. r1 = Rule {

[Haskell-cafe] Re: [fp-embedded] Which Haskell DSL for writing C? (Was ANN: Copilot 0.22 -- A stream DSL for writing embedded C.)

2010-09-21 Thread Emil Axelsson
2010-09-21 22:32, Lee Pike skrev: Oh, one thing I should mention is that there are a few Haskell DSLs for generating embedded C now: * Atom http://hackage.haskell.org/package/atom * Feldspar http://hackage.haskell.org/package/feldspar-language * cmonad

[Haskell-cafe] ANNOUNCE: feldspar 0.3

2010-07-17 Thread Emil Axelsson
On behalf of the Feldspar team, I'm happy to announce a new release of the embedded language Feldspar and its C code generator: http://hackage.haskell.org/package/feldspar-language http://hackage.haskell.org/package/feldspar-compiler The main changes in 0.3 are: * Signed/unsigned

Re: [Haskell-cafe] Build problems on Hackage server

2010-07-08 Thread Emil Axelsson
2010-07-08 09:01, Ross Paterson skrev: On Wed, Jul 07, 2010 at 10:22:25AM +0200, Emil Axelsson wrote: Last week I uploaded new versions of feldspar-language and feldspar-compiler. Both packages build just fine on our local machines with GHC 6.10 and 6.12. But Hackage reports the following

[Haskell-cafe] Build problems on Hackage server

2010-07-07 Thread Emil Axelsson
Hello Last week I uploaded new versions of feldspar-language and feldspar-compiler. Both packages build just fine on our local machines with GHC 6.10 and 6.12. But Hackage reports the following build failure: cabal: dependencies conflict: ghc-6.12.2 requires array ==0.3.0.1 however

Re: [Haskell-cafe] How to use unsafePerformIO properly (safely?)

2010-03-31 Thread Emil Axelsson
In Feldspar's module for observable sharing [1] I use the following {-# OPTIONS_GHC -O0 #-} which I assumed would take care of the steps required for unsafePerformIO. Could someone please tell if this assumption is correct? (Of course, observable sharing is not safe regardless, but that's

[Haskell-cafe] ANNOUNCE: feldspar-language-0.2, feldspar-compiler-0.2

2010-03-16 Thread Emil Axelsson
We are happy to announce the new release of Feldspar and its compiler! http://feldspar.sourceforge.net/ Feldspar is an embedded domain-specific language for digital signal processing. It is developed as a joint project with Ericsson, ELTE university and Chalmers university. This is an

Re: [Haskell-cafe] Non-termination due to context

2010-01-25 Thread Emil Axelsson
example some more, thank you. Meanwhile, it's clear that you are on thin ice. Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe-boun...@haskell.org] On | Behalf Of Emil Axelsson | Sent: 22 January 2010 11:25 | To: Haskell Cafe | Subject: [Haskell-cafe

[Haskell-cafe] Non-termination due to context

2010-01-22 Thread Emil Axelsson
Hello all! Consider the following program: {-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-} class B a = A a instance A Int class Eq a = B a instance (A a, Eq a) = B a eq :: B a = a - a - Bool eq = (==) test = 1 `eq` (2::Int) (This is a condensed version of

Re: [Haskell-cafe] Non-termination due to context

2010-01-22 Thread Emil Axelsson
Ross Paterson skrev: On Fri, Jan 22, 2010 at 12:24:37PM +0100, Emil Axelsson wrote: Consider the following program: {-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances #-} class B a = A a instance A Int class Eq a = B a instance (A a, Eq a) = B a [...] Although I

Re: [Haskell-cafe] Re: FASTER primes

2010-01-05 Thread Emil Axelsson
Will Ness skrev: Emil Axelsson emax at chalmers.se writes: For me, a real smart compiler is one that would take in e.g. (sum $ take n $ cycle $ [1..m]) and spill out a straight up math formula, inside a few ifs maybe (just an aside). (Also an aside, I couldn't resist...) Then I'm sure

Re: [Haskell-cafe] Re: FASTER primes

2010-01-04 Thread Emil Axelsson
For me, a real smart compiler is one that would take in e.g. (sum $ take n $ cycle $ [1..m]) and spill out a straight up math formula, inside a few ifs maybe (just an aside). (Also an aside, I couldn't resist...) Then I'm sure you'd say that Feldspar [1] has a smart compiler :) The above

Re: [Haskell-cafe] writing graphs with do-notation

2009-12-15 Thread Emil Axelsson
as the basis for a generic implementation: http://www.ittc.ku.edu/~andygill/paper.php?label=DSLExtract09 As long as you do your reification in the IO monad, Andy's library gives you the graph conversion for (almost-) free. -Levent. On Dec 13, 2009, at 10:48 PM, Emil Axelsson wrote: Hi

Re: [Haskell-cafe] writing graphs with do-notation

2009-12-13 Thread Emil Axelsson
Hi! This technique has been used to define netlists in hardware description languages. The original Lava [1] used a monad, but later switched to using observable sharing [2]. Wired [3] uses a monad similar to yours (but more complicated). I think it would be nice to have a single library

Re: [Haskell-cafe] ANNOUNCE: feldspar-language

2009-11-25 Thread Emil Axelsson
(In response to Tom Hawkins' posting of an IIR filter in Atom) We're still experimenting with how to best describe streaming computations with feedback in Feldspar. But for completeness, here one possible implementation of an IIR filter: iir :: forall m n o a . (NaturalT m, NaturalT n,

Re: [Haskell-cafe] ANNOUNCE: feldspar-language

2009-11-09 Thread Emil Axelsson
Tom Hawkins skrev: On Fri, Nov 6, 2009 at 6:28 AM, Emil Axelsson e...@chalmers.se wrote: I'm trying to get realtime signal processing with Haskell for long. I make progress, but slowly. Has Ericsson ever thought about using Haskell itself for signal processing? (But I think they already have

Re: [Haskell-cafe] ANNOUNCE: feldspar-language

2009-11-04 Thread Emil Axelsson
- includes an example involving autocorrelation. Does this mean I could use Feldspare to easily build my own Autotune program? I love T-Pain and Autotune the News! Warren On Tue, Nov 3, 2009 at 7:39 PM, Emil Axelsson e...@chalmers.se wrote: I'm happy to announce the first release of Feldspar, which

[Haskell-cafe] ANNOUNCE: feldspar-language

2009-11-03 Thread Emil Axelsson
I'm happy to announce the first release of Feldspar, which is an embedded domain-specific language with associated code generator mainly targeting DSP algorithms. The language is developed in cooperation by Ericsson, Chalmers University and Eötvös Loránd University. Feldspar stands for

Re: [Haskell-cafe] What *is* a DSL?

2009-10-07 Thread Emil Axelsson
Hi, A DSL is just a domain-specific language. It doesn't imply any specific implementation technique. An *embedded* DSL is a library implemented in a more general language, which has been designed to give the feeling of a stand-alone language. Still nothing about implementation. A

Re: [Haskell-cafe] Re: What *is* a DSL?

2009-10-07 Thread Emil Axelsson
Ben Franksen skrev: minh thu wrote: 2009/10/7 Günther Schmidt gue.schm...@web.de: I've informally argued that a true DSL -- separate from a good API -- should have semantic characteristics of a language: binding forms, control structures, abstraction, composition. Some have type systems.

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Emil Axelsson
Not sure this is what you want, but I thought I'd mention Formal Specifications for Free: http://www.erlang.org/euc/08/1005Hughes2.pdf (I wasn't able to find a better link. That talk is for Erlang, but people are working on this for Haskell QuickCheck.) / Emil Yusaku Hashimoto skrev:

Re: [Haskell-cafe] QuickCheck Questions

2009-09-28 Thread Emil Axelsson
Pasqualino Titto Assini skrev: Fantastic. If I understand correctly it inductively derives equations that hold for a set of examples. AFAIU, it enumerates a set of terms and uses random testing to approximate an equivalence relation for these. The real trick, apparently, is in filtering out

[Haskell-cafe] Strange type error (tfp package + GADTs)

2009-09-09 Thread Emil Axelsson
Hi Café, Can anyone explain why `add1` is rejected in the code below (which uses the tfp package): import Types.Data.Num data A n where A :: NaturalT n = Int - A n getA :: A n - Int getA (A n) = n add1 :: NaturalT (m:+:n) = A m - A n - A (m:+:n) add1 (A a) (A b) = A (a+b) add2 ::

Re: [Haskell-cafe] Strange type error (tfp package + GADTs)

2009-09-09 Thread Emil Axelsson
I forgot to say that I'm using GHC 6.10.1. Also, the code requires {-# LANGUAGE FlexibleContexts, GADTs, TypeOperators #-} / Emil Emil Axelsson skrev: Hi Café, Can anyone explain why `add1` is rejected in the code below (which uses the tfp package): import Types.Data.Num data A n

Re: [Haskell-cafe] Nested Lists

2009-06-04 Thread Emil Axelsson
Hi Paul, I don't have time to solve your actual problem, but I think it's doable using associated type families. I attach a module which I'm using in my current project that does things quite similar to what you're asking for. For example: *Main replicateArray (3 : IntArr) 4 [4,4,4]

[Haskell-cafe] ANN: Bookshelf

2009-05-13 Thread Emil Axelsson
This is the first release of Bookshelf, a simple document organizer with some wiki functionality. Documents in a directory tree are displayed as a set of HTML pages. Documents in Markdown format are converted to HTML automatically using Pandoc. The manual

Re: [Haskell-cafe] ANN: Bookshelf

2009-05-13 Thread Emil Axelsson
I've added a missing source file (and the documentation files) to Hackage. Hope it works now... Also, if anyone tries it on Windows, please let me know if it works. If not, patches are welcome. / Emil Emil Axelsson skrev: This is the first release of Bookshelf, a simple document organizer

Re: [Haskell-cafe] Re: ANN: Bookshelf

2009-05-13 Thread Emil Axelsson
m...@justinbogner.com skrev: Emil Axelsson e...@chalmers.se writes: This is the first release of Bookshelf, a simple document organizer with some wiki functionality. Documents in a directory tree are displayed as a set of HTML pages. Documents in Markdown format are converted to HTML

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Emil Axelsson
Sorry, I misread the task :) / Emil Emil Axelsson skrev: Why not: diag = [(x, sum-x) | sum - [2..], x - [1 .. sum-1]] / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Code Golf

2009-04-15 Thread Emil Axelsson
Why not: diag = [(x, sum-x) | sum - [2..], x - [1 .. sum-1]] / Emil MigMit skrev: If I understand the problem correctly... Prelude let diag = concat . diags where diags ((x:xs):xss) = [x] : zipWith (:) xs (diags xss) Prelude take 10 $ diag [[ (m,n) | n - [1..]] | m - [1..]]

[Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-02 Thread Emil Axelsson
Hello, Are there any Haskell tutorials suitable for people who don't (and possibly don't want to) know Haskell, but just want to use an embedded language that happens to be in Haskell? Such a tutorial would focus on using libraries rather than defining them. For example, it might explain

Re: [Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-02 Thread Emil Axelsson
Hi Deniz, Deniz Dogan skrev: I don't think it's a good idea (or even possible) to use a Haskell library without knowing anything about Haskell or functional programming. However, it shouldn't take too long to learn the very Well, I guess I was asking for a tutorial which covers everything

Re: [Haskell-cafe] Haskell tutorial for pseudo users?

2009-02-02 Thread Emil Axelsson
but it covers all the relvant portions you asked about. Download the package, unzip it and you'll find my Haskell Cheat Sheet PDF inside: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/CheatSheet On Mon, Feb 2, 2009 at 6:35 AM, Emil Axelsson e...@chalmers.se wrote: Hello

[Haskell-cafe] ANN: Wired 0.2

2009-01-26 Thread Emil Axelsson
There is now a new release of Wired available: http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Wired The most important news in this release is that it now contains a 45nm cell library, which means that you can use Wired to create and analyze modern VLSI designs[*] today!

Re: [Haskell-cafe] about the concatenation on a tree

2008-12-31 Thread Emil Axelsson
I'm not working, but still checking mail. If you don't care about balancing the tree or the order of elements, you can just use Branch :: Tree a - Tree a - Tree a as a concatenation operator. Check with GHCi to see that the Branch constructor actually has the above type. / Emil Max

Re: [Haskell-cafe] How to think about this? (profiling)

2008-12-16 Thread Emil Axelsson
This is actually a perfect case for lazy immutable arrays, if you use a circular program: import Data.Array foo' :: Array Int Int - Int - Int foo' arr 0 = 0 foo' arr 1 = 1 foo' arr 2 = 2 foo' arr n = arr!(n-1) + arr!(n-2) + arr!(n-3) foo :: Int - Int foo n = arr ! n where assocs = [(i,

[Haskell-cafe] Exact parsing of decimal numbers

2008-12-09 Thread Emil Axelsson
Hello, I don't know enough about the RealFrac class to answer this myself: Can I be sure that Numeric.readFloat :: ReadS Rational never exhibits any rounding errors? Thanks, / Emil ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Combining licences

2008-12-01 Thread Emil Axelsson
Henning Thielemann skrev: On Mon, 1 Dec 2008, Emil Axelsson wrote: Or perhaps it's better to put the cell library in its own package? I'm a bit reluctant to do this, because it means that Wired will be essentially useless on its own. It's more the question, whether a Haskell wrapper

[Haskell-cafe] Combining licences

2008-11-30 Thread Emil Axelsson
Hello, I know very little about licensing, so I'm hoping to get some advice from you guys. In the next release of Wired, I plan to include an open-source standard cell library (or rather data derived from it). This cell library has a custom license (found at the bottom of

[Haskell-cafe] FFI and GHCi

2008-10-21 Thread Emil Axelsson
Hi, I'm making my first attempt at using some C code in my Haskell program. I need it because I have a large amount of small constant tables, and GHC takes ages to compile the if I use ordinary lists (and the object file gets huge). If there's any way of achieving this without going to C, I'd

Re: [Haskell-cafe] FFI and GHCi

2008-10-21 Thread Emil Axelsson
/html/users_guide/ghci-dot-files.html -Corey O'Connor On Tue, Oct 21, 2008 at 9:10 AM, Emil Axelsson [EMAIL PROTECTED] wrote: Hi, I'm making my first attempt at using some C code in my Haskell program. I need it because I have a large amount of small constant tables, and GHC takes ages

Re: [Haskell-cafe] Functional dependencies and incoherent instances

2008-10-08 Thread Emil Axelsson
I think the technique described at http://haskell.org/haskellwiki/GHC/AdvancedOverlap may give you what you want. I've never tried it myself though. / Emil Tobias Bexelius skrev: Yeah, I realized that. But heres where I would like the undecidable incoherent instances to kick in, i.e.

Re: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Emil Axelsson
Hi Cetin! Glad to see at least one person trying my package :) The error comes from using QuickCheck 2, which happens to also use the operator (). I can see two ways to solve the problem: (1) Add 2 after QuickCheck in the Wired.cabal file. (2) Add hiding (()) after import Test.QuickCheck

Re: [Haskell-cafe] Hackage Build Failures

2008-10-01 Thread Emil Axelsson
Stephan Friedrichs skrev: Emil Axelsson wrote: [...] The error comes from using QuickCheck 2, which happens to also use the operator (). I can see two ways to solve the problem: (1) Add 2 after QuickCheck in the Wired.cabal file. (2) Add hiding (()) after import Test.QuickCheck in Data

[Haskell-cafe] ANNOUNCE: Wired 0.1.1

2008-08-27 Thread Emil Axelsson
Hello, This is to announce the first release of the hardware description library Wired. Wired can be seen as an extension to Lava that targets (not exclusively) semi-custom VLSI design. A particular aim of Wired is to give the designer more control over the routing wires' effects on

Re: [Haskell-cafe] Why doesn't this work?

2008-08-24 Thread Emil Axelsson
BTW, this is a case where it may be more convenient to use forM: forM ps $ \pix - do particle - read_grid g pix return $ fn particle (untested...) forM is just another way of saying (flip mapM). / Emil Andrew Coppin skrev: colour_grid :: (Particle - IO ()) - Grid ph - IO ()

Re: [Haskell-cafe] Help with associated types

2008-04-21 Thread Emil Axelsson
-parameter class, which makes things a lot nicer. / Emil On 2008-04-19 14:57, Niklas Broberg wrote: Hi Emil, On 4/17/08, Emil Axelsson [EMAIL PROTECTED] wrote: Hello! I'm trying to rewrite some FD classes to use associated types instead. The Port class is for type structures whose leaves have

Re: [Haskell-cafe] Help with associated types

2008-04-18 Thread Emil Axelsson
After some thinking I think I can put my question much simpler: If I have a class with some dependencies, say a - ..., b c - ... Is it possible to encode this using associated types without having all of a, b and c as class parameters? It seems to me that it's not possible. And if so,

[Haskell-cafe] Help with associated types

2008-04-17 Thread Emil Axelsson
Hello! I'm trying to rewrite some FD classes to use associated types instead. The Port class is for type structures whose leaves have the same type: class Port p where type Leaf p type Struct p toList :: p - [Leaf p] fromList :: [Leaf p] - p (Leaf p) gives

[Haskell-cafe] Template Haskell -- when are things evaluated?

2008-03-13 Thread Emil Axelsson
Hello all! Up until yesterday I thought I understood the basics of Template Haskell, but now I'm a little confused. Consider the following code module A where a1 = [| (2::Int) + 2 |] a2 = let x = (2::Int) + 2 in [| x |] a3 = [| y |] where y = (2::Int) + 2 z

Re: [Haskell-cafe] Template Haskell -- when are things evaluated?

2008-03-13 Thread Emil Axelsson
:00 AM, Emil Axelsson [EMAIL PROTECTED] wrote: a1 = [| (2::Int) + 2 |] You are lifting the expression AST, not its evaluation. a1 = lift ((2::Int) + 2) would work as you want. a2 = let x = (2::Int) + 2 in [| x |] here you are enclosing a local variable in quasiquotes and, thus

Re: [Haskell-cafe] Template Haskell -- when are things evaluated?

2008-03-13 Thread Emil Axelsson
wrote: Hi Emil, Your problem is related to how are things evaluated not when. The short answer is: if you want to make sure an expression is evaluated before you lift it, don't use quasiquotes, call Language.Haskell.TH.lift On Thu, Mar 13, 2008 at 9:00 AM, Emil Axelsson [EMAIL PROTECTED] wrote

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-07 Thread Emil Axelsson
I know of a few of ways to express sharing in a pure language: 1) Observable sharing, which, in general, is unsafe. http://www.cs.chalmers.se/~koen/pubs/entry-asian99-lava.html 2) Using Template Haskell http://www.dcs.gla.ac.uk/publications/PAPERS/7524/EmbedHDLinTH.ps 3) Matthew Naylor

Re: [Haskell-cafe] Show instances for error messages (Was: Refactoring status)

2008-01-09 Thread Emil Axelsson
I think partial type signatures http://hackage.haskell.org/trac/haskell-prime/wiki/PartialTypeAnnotations would allow that kind of tunneling. Is there any ongoing work on that? / Emil Henning Thielemann skrev: On Mon, 7 Jan 2008, Emil Axelsson wrote: One approach to programming

Re: [Haskell-cafe] Refactoring status

2008-01-07 Thread Emil Axelsson
One approach to programming in Haskell, which I use all the time, is to write the type signature before the function body. This means that if I'm trying to do something strange, I will often be warned by the type checker even before I've written the strange code. But I've also been bitten by

Re: [Haskell-cafe] Show instances for error messages (Was: Refactoring status)

2008-01-07 Thread Emil Axelsson
The only possible definition of such a function is something like unsafeShow :: (forall a . Show a = a) - String unsafeShow a = show (a :: Bool) right? And you'd also need to coerce the argument type in order to use it: putStrLn $ unsafeShow $ unsafeCoerce True Right? Then a nicer

[Haskell-cafe] Class deriving in GHC 6.8

2007-12-20 Thread Emil Axelsson
Hello all! How come in GHC 6.6 I could to write {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-} data Foo = Foo deriving Show data Bar c = Bar (c Foo) deriving Show but in GHC 6.8.2 I get the error No instance for (Show (c Foo)) arising from the

Re: [Haskell-cafe] Class deriving in GHC 6.8

2007-12-20 Thread Emil Axelsson
11:18, Emil Axelsson wrote: Hello all! How come in GHC 6.6 I could to write {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-} data Foo = Foo deriving Show data Bar c = Bar (c Foo) deriving Show but in GHC 6.8.2 I get the error No instance for (Show (c Foo

Re: [Haskell-cafe] unification would give infinite type

2007-12-05 Thread Emil Axelsson
You usually don't need to worry about it. Just keep in mind that if you happen to get a strange type error concerning an (overloaded) function *without type signature*, it sometimes helps to add a signature. / Emil On 2007-12-04 15:52, Rafael wrote: I don't know about monomorphis

Re: [Haskell-cafe] unification would give infinite type

2007-12-04 Thread Emil Axelsson
Hi, Depending on what you want, you should either remove 'return' or change to 'foldM' (from Control.Monad). If you choose the latter, you also need to add a type signature to f (because of the monomorphism restriction). / Emil On 2007-12-04 14:43, Rafael wrote: Hi... I give this error

Re: [Haskell-cafe] Re: FP design

2007-11-07 Thread Emil Axelsson
You mean: Jonh Hughes. The Design of a Pretty-printing Library. :) / Emil On 2007-11-07 05:16, apfelmus wrote: Paul Hudak. The Design of a Pretty-printing Library. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Strictness leak

2007-10-30 Thread Emil Axelsson
You mean for the IO monad, right? take 10 $ execWriter $ sequence $ repeat $ tell ([3]::[Int]) / Emil On 10/30/2007 02:04 PM, Jeff Polakow wrote: Hello, countIO :: String - String - Int - [a] - IO [a] countIO msg post step xs = sequence $ map unsafeInterleaveIO ((blank outmsg

[Haskell-cafe] Selecting overlapping instances

2007-02-22 Thread Emil Axelsson
Hello! I have a problem with overlapping instances for which I already know a workaround. However, I'm still curious to know if there isn't a simpler solution available. I have a feeling that -fallow-incoherent-instances might be the answer, but I can't get it to work. In the code at the

Re: [Haskell-cafe] Haskell as embedded DSL

2006-07-05 Thread Emil Axelsson
Joel Reymont skrev: On Jul 5, 2006, at 3:07 PM, Niklas Broberg wrote: Lava: http://www.cs.chalmers.se/~koen/Lava/ Excellent example, thank you Niklas! Are you using QuickCheck for verification? I assume you're asking if Lava (rather than Niklas) uses QuickCheck. In Lava, you write

  1   2   >