Re: [Haskell-cafe] type constructor section for (- Bool), _not_ ((-) Bool)

2013-09-03 Thread Brent Yorgey
On Tue, Sep 03, 2013 at 11:33:46AM +, AntC wrote:
 I'm probably being dumb, but Hoogle nor the wiki are helping me.
 
 I want an instance and type improvement constraint of the form
 
 instance (f ~ (- Bool)) = C Foo (f b) where ...
 
 The first arg to C is driving type improvement, for example:
 
 instance (f ~ []) = C Bar (f b) where ...
 
 (The real instances are more complex, and involve overlap, of course.)
 
 I'm trying to write a section to get the improved type (b - Bool), 
 but (- Bool) or ((- Bool) b) is invalid syntax.

There is no operator section syntax for types.  Moreover, this is not
just an issue of syntax: it is impossible to partially apply a type
constructor to anything other than its first argument, because there
is no type-level lambda.

 This is valid, but wrong: ((-) Bool) b  -- gives (Bool - b).
 
 I could do:
 
 data FlipFun b  -- abstract
 instance (f ~ FlipFun) = C Foo (f b) where ...
 
 And a type function inside the class to generate the type.
 But then I'd have to apply the type function for all instances,
 and in most places it'd be id.

That's the only way to do it that I know of.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] One-element tuple

2013-08-16 Thread Brent Yorgey
On Fri, Aug 16, 2013 at 01:35:22AM +, AntC wrote:
 There's an annoying inconsistency:
 
 (CustId 47, CustName Fred, Gender Male)  -- threeple
 (CustId 47, CustName Fred)-- twople
 --  (CustId 47)-- oneple not!
 () -- nople
 
 (That is, it's annoying if you're trying to make typeclass instances for 
 extensible/contractable tuples. Yes, I know I could use HLists.)
 
 I'm not happy with either approach I've tried:
 
 data Oneple a = Oneple a   -- (or newtype)
 (Oneple $ CustId 47)   -- too verbose
 
 type Oneple a = [a]
 [CustId 47]  -- at least looks bracket-y
 
 What do you do?

This is what the OneTuple package is for:

  http://hackage.haskell.org/package/OneTuple

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Call for Participation: Workshop on Functional Art, Music, Modeling and Design

2013-08-08 Thread Brent Yorgey
==
  FARM 2013: Call for Participation

  ACM SIGPLAN Workshop on Functional Art, Music, Modeling and Design
  Boston, Massachusetts, USA
  28th September, 2013 (directly after ICFP)

  http://www.cis.upenn.edu/~byorgey/farm13/
==

The functional programming community is largely interested in writing
beautiful programs. This workshop is intended to gather researchers and
practitioners interested in writing beautiful programs that generate
beautiful artifacts. Such artifacts may include visual art, music, 3D
sculptures, animations, GUIs, video games, physical models,
architectural models, choreographies for dance, poetry, and even
physical objects such as VLSI layouts, GPU configurations, or mechanical
engineering designs.

The goal of FARM is to gather together researchers, practitioners, and
educators in this interdisciplinary field, as well as anyone else with
even a casual interest in the area. We wish to share ideas, look for
common ground, and encourage more activity. We also hope to legitimize
work in the field and facilitate potential collaboration among the
participants.

Registration


Deadline for early registration: 22 August 2013

  https://regmaster3.com/2013conf/ICFP13/register.php

This is the registration site for ICFP 2013 and all the affiliated
workshops including FARM 2013.

Accepted papers and demonstrations
--

-   Samuel Aaron and Alan F. Blackwell. From Sonic Pi to Overtone:
Creative Musical Experiences with Domain-Specific and Functional
Languages
-   Henrik Bäärnhielm, Mikael Vejdemo-Johansson and Daniel Sundström.
Using Haskell as DSL for controlling immersive media experiences
(Demo)
-   Guillaume Baudart, Louis Mandel and Marc Pouzet. Programming Mixed
Music in ReactiveML
-   Jean Bresson, Raphael Foulon and Marco Stroppa. Reduction as a
Transition Controller for Sound Synthesis Events
-   Kelsey D'Souza. PySTEMM - A STEM Learning Tool for Exploring and
Building Executable Concept Models (Demo)
-   Andy Gill and Brent A. Yorgey. Functional active animation (Demo)
-   Jason Hemann and Eric Holk. Visualizing the Turing Tarpit
-   Paul Hudak. Euterpea: From Signals to Symphonies (Demo)
-   David Janin, Florent Berthaut, Myriam Desainte-Catherine, Yann
Orlarey and Sylvain Salvati. The T-Calculus : towards a structured
programing of (musical) time and space
-   David Janin and Florent Berthaut. LiveTuiles for tiled composition
of audio patterns (Demo)
-   Thomas Jordan. Spontaneous Musical Explorations of Visible Symmetric
Structures (Demo)
-   Hendrik Vincent Koops, José Pedro Magalhães and W. Bas de Haas. A
Functional Approach To Automatic Melody Harmonisation
-   José Pedro Magalhães, Bas De Haas, Gijs Bekenkamp, Dion ten Heggeler
and Tijmen Ruizendaal. Chordify: Chord Transcription for the Masses
(Demo)
-   Donya Quick and Paul Hudak. Grammar-Based Automated Music
Composition in Haskell
-   Chung‐chieh Shan and Dylan Thurston. Braiding in circles (Demo)

Workshop Organization
-

Workshop Chair: Paul Hudak
Program Chair: Conal Elliott
Publicity Chair: Brent Yorgey

Program Committee
-

-   Daniel Cukier (AgileAndArt)
-   Conal Elliott (Tabula) (chair)
-   Kathleen Fisher (Tufts University)
-   Richard Gabriel (IBM Research)
-   George Giorgidze (University of Tübingen)
-   Paul Hudak (Yale University)
-   José Pedro Magalhães (University of Oxford)
-   Alex McLean (University of Leeds)
-   John Peterson (Western State Colorado University)
-   Michael Sperber (Active Group)
-   Henning Thielemann (Martin-Luther-Universität Halle-Wittenberg)
-   Brent Yorgey (University of Pennsylvania)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Do combinatorial algorithms have a matroid strucutre XOR non-matroid structure?

2013-07-14 Thread Brent Yorgey
On Thu, Jul 11, 2013 at 03:39:02PM -0700, KC wrote:
 I ask this on this mailing list because there are quite a few
 mathematically oriented people here.

If you accept the Law of Excluded Middle, everything either has a
matroid structure, or not.  On the other hand, if you do not accept
it, then there may be some combinatorial algorithms which have neither
(because we have not found a matroid structure, or proved one does not
exist).  Either way, I do not understand the point of your question.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Music / MIDI help

2013-07-10 Thread Brent Yorgey
Maybe Euterpea?

http://haskell.cs.yale.edu/euterpea/download/

On Wed, Jul 10, 2013 at 08:20:08AM -0700, Mark Lentczner wrote:
 I'm a little lost in the bewildering array of music packages for Haskell,
 and need some help.
 
 I'm looking to recreate one of my algorithmic music compositions from the
 1980s. I can easily code the logic in Haskell.
 
 I'm looking for a the right set of packages and SW so that I can:
 a) generate short sequences and play them immediately, preferrably in ghci,
 -- but 'runHaskell Foo.hs | barPlayer' would be acceptable
 2) generate MIDI files
 
 I'm on OS X.
 
 So far what I've found is: Haskore, the midi package, and the jack package
 - and then I'd need some MIDI software synth for the Mac, and Jack based
 patcher Or perhaps I want SuperCollider, and the Haskell bindings - but
 that seems rather low level for my needs here (I don't really need to patch
 together my instruments, and I don't want to have re-write the whole timing
 framework from scratch.)
 
 So - What's a quick easy path here?
 
 - Mark

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Open Source project suitable for 2-3 persons this fall?

2013-07-09 Thread Brent Yorgey
On Thu, Jul 04, 2013 at 05:26:59PM +0200, Anders Bech Mellson wrote:
 Is there any project that needs working this fall which could be used as a
 university project?
 
 I am in the university (M.Sc. in software development),
 so I am mainly looking for project ideas (preferably concrete ones).
 
 We are 2-3 students that have ~10 hours pr week for 3 months to work on a
 project.
 
 Is there a listing somewhere with project ideas for contributing to the
 Haskell community?

I am a bit late, but there are quite a few things that could be done
for the diagrams project [1].  Some project ideas are at [2], and more
can be found on the bug tracker [3].

[1] http://projects.haskell.org/diagrams/
[2] http://www.haskell.org/haskellwiki/Diagrams/Projects
[3] https://github.com/diagrams/diagrams-lib/issues?state=open

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Call for Demo Proposals: Workshop on Functional Art, Music, Modeling and Design

2013-07-03 Thread Brent Yorgey
Hi all,

Below is the call for demonstration proposals for FARM 2013.  Please
forward to anyone who might be interested -- apologies if you receive
multiple copies!

Brent Yorgey
publicity chair for FARM 2013


==
  FARM 2013: Call for Demo Proposals

  ACM SIGPLAN Workshop on Functional Art, Music, Modeling and Design
  Boston, Massachusetts, USA
  28th September, 2013 (directly after ICFP)

  http://www.cis.upenn.edu/~byorgey/farm13/
==


Do you enjoy writing beautiful code to produce beautiful artifacts? Have
something cool to show off at the intersection of functional programming
and visual art, music, sound, modeling, visualization, or design?

FARM 2013 is seeking proposals for 10-20 minute demonstrations to be
given during the workshop. For example, a demonstration could consist of
a short tutorial, an exhibition of some work, or even a livecoding
performance. Slots for demonstrations will be shorter than slots for
accepted papers, and will not be published as part of the formal
proceedings, but can be a great way to show off interesting work and get
feedback from other workshop participants. A demonstration slot could be
a particularly good way to get feedback on work-in-progress.

Scope
-

The functional programming community is largely interested in writing
beautiful programs. This workshop is intended to gather researchers and
practitioners interested in writing beautiful programs that generate
beautiful artifacts. Such artifacts may include visual art, music, 3D
sculptures, animations, GUIs, video games, physical models,
architectural models, choreographies for dance, poetry, and even
physical objects such as VLSI layouts, GPU configurations, or mechanical
engineering designs. The framework used need not be purely functional
(“mostly functional” is fine); may be based on abstractions such as
higher-order functions, monads, arrows, or streams; and may be
manifested as a domain specific language or tool. Theoretical
foundations, language design, implementation issues, and applications
are all within the scope of the workshop.

Important dates
---

-   Demonstration proposals due: Wednesday, 31 July 2013, 18:00 EDT
(UTC-4)

-   Author notification: Monday, 5 August 2013

-   Workshop: Saturday, 28 September 2013 (the day after ICFP)

A demo proposal should consist of a 1 page abstract, in PDF format,
explaining the proposed content of the demonstration and why it would be
of interest to the attendees of FARM. Proposals will be judged on
interest and relevance to the stated goals and themes of the workshop.

Submissions can be made via EasyChair at
https://www.easychair.org/conferences/?conf=farm2013.

Organizers
--

Workshop Chair: Paul Hudak
Program Chair: Conal Elliott
Publicity Chair: Brent Yorgey

Program Committee
-

Daniel Cukier (University of São Paulo)
Conal Elliott (Tabula) (chair)
Kathleen Fisher (Tufts University)
Richard Gabriel (IBM Research)
George Giorgidze (University of Tübingen)
Paul Hudak (Yale University)
José Pedro Magalhães (University of Oxford)
Alex McLean (University of Leeds)
John Peterson (Western State Colorado University)
Michael Sperber (Active Group)
Henning Thielemann
Brent Yorgey (University of Pennsylvania)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Brent Yorgey
On Wed, Jun 19, 2013 at 11:11:16AM +0100, Francesco Mazzoli wrote:
 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 what's going on well enough for me.
 
 Did you read the rest of the code?  That ought to work, because GHC
 infers and uses the type equality (something like ‘v ~ Var v1’) and uses
 it to coerce the ‘x’.
 
 And, surprise surprise, if the argument order is switched, it works!
 
 data Foo v where
 Foo :: forall v. Foo (Maybe v)
 
 foo1 :: Foo a - a - Int
 foo1 Foo Nothing  = undefined
 foo1 Foo (Just x) = undefined

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 one-argument functions which
return functions.  So a function of type

  foo1 :: a - (Foo a - Int)

must take something of type a (for *any* choice of a, which the caller
gets to choose) and return a function of type (Foo a - Int).  *Which*
function is returned (e.g. one that tries to pattern match on the Foo)
makes no difference to whether foo1 typechecks.

On the other hand, a function of type

  foo2 :: Foo a - (a - Int)

receives something of type Foo a as an argument.  It may pattern-match
on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
Now when constructing the output function of type (a - Int) it may
make use of this fact.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: Nomyx 0.2 beta, the game where you can change the rules

2013-06-19 Thread Brent Yorgey
This is great fun, more people should come and join us! =)

  http://www.nomyx.net:8000/Nomyx

we are playing game demo3.

-Brent

On Fri, Jun 14, 2013 at 05:57:57PM +0200, Corentin Dupont wrote:
 Hello everybody!
 Here it comes, the second beta release [1] of Nomyx, the only game where
 You can change the rules!!
 This is an implementation of a Nomic [2] game in Haskell (I believe the
 first complete implementation of a Nomic game on a computer). In a
 Nomyxgame you can change the rules of the game itself while playing
 it. The
 players can submit new rules or modify existing ones, thus completely
 changing the behaviour of the game through time. The rules are managed and
 interpreted by the computer. They must be written in the Nomyx language,
 which is a subset of Haskell.
 
 At the beginning, the initial rules are describing:
 - how to add new rules and change existing ones. For example a unanimity
 vote is necessary to have a new rule accepted.
 - how to win the game. For example you win the game if you have 5 rules
 accepted.
 But of course even that can be changed!
 
 Here is a video introduction and first tutorial of the game:
 http://vimeo.com/58265498
 The game is running here: www.nomyx.net:8000/Nomyx
 I have set up a forum where players can learn about Nomyx and discuss the
 rules they intend to propose: www.nomyx.net/forum
 The example file gives a lot of examples of rules that you can submit:
 www.nomyx.net:8000/src/Language/Nomyx/Examples.hs
 
 Changes from V0.1:
 - new login system: you can now login with your Google, Yahoo, Live
 Journal, Myspace, OpenId or Facebook accounts (thanks to
 happstack-authenticate)!
 - new DSL for voting (see below)
 - styling: rule code colorized, better settings and help
 - use cookies to store the user ID (as suggested on this mailing list)
 - new error system to handle exceptions in rules (with ErrorT)
 - use lenses
 
 I set up a little DSL to create elections (elect one of the players for a
 special role) or referendums (a yes/no question).
 You create in one line within Nomyx an vote with unanimity or majority, a
 quorum and different ballot systems. See here:
 http://www.nomyx.net/forum/viewtopic.php?f=3t=1518
 
 Let's test it! If you are interested, please go to this forum thread and
 we'll set up a small team to start a match!
 http://www.nomyx.net/forum/viewtopic.php?f=4t=1517
 The demo game is running here: www.nomyx.net:8000/Nomyx then select game
 demo2.
 As the first player of the game, I changed the initial unanimity vote to a
 simple majority, with a minimum of 2 players voting. Having your new rules
 accepted will be easy!
 Let's see who will win :)
 
 Cheers,
 Corentin
 
 [1] http://hackage.haskell.org/package/Nomyx
 [2] www.nomic.net

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GADTs and pattern matching

2013-06-19 Thread Brent Yorgey
Good point.  I stand corrected.

-Brent

On Wed, Jun 19, 2013 at 11:42:23AM -0300, Felipe Almeida Lessa wrote:
 Brent, maybe I'm misunderstanding what you're saying, but I don't
 think that the order of the arguments is playing any role here besides
 defining the order in which the pattern matches are desugared.
 
 To illustrate,
 
   -- This does work
   foo1' :: a - Foo a - Int
   foo1' m Foo = case m of
   Nothing - undefined
   Just _  - undefined
 
 Despite having the same type as foo1, foo1' does work because now I've
 pattern matched on the GADT first.  As soon as I do that, its equality
 constraint of (a ~ Maybe v) enters into scope of the case branches.
 
 Cheers,
 
 On Wed, Jun 19, 2013 at 7:59 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
  On Wed, Jun 19, 2013 at 11:11:16AM +0100, Francesco Mazzoli wrote:
  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 what's going on well enough for me.
 
  Did you read the rest of the code?  That ought to work, because GHC
  infers and uses the type equality (something like ‘v ~ Var v1’) and uses
  it to coerce the ‘x’.
 
  And, surprise surprise, if the argument order is switched, it works!
 
  data Foo v where
  Foo :: forall v. Foo (Maybe v)
 
  foo1 :: Foo a - a - Int
  foo1 Foo Nothing  = undefined
  foo1 Foo (Just x) = undefined
 
  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 one-argument functions which
  return functions.  So a function of type
 
foo1 :: a - (Foo a - Int)
 
  must take something of type a (for *any* choice of a, which the caller
  gets to choose) and return a function of type (Foo a - Int).  *Which*
  function is returned (e.g. one that tries to pattern match on the Foo)
  makes no difference to whether foo1 typechecks.
 
  On the other hand, a function of type
 
foo2 :: Foo a - (a - Int)
 
  receives something of type Foo a as an argument.  It may pattern-match
  on the Foo a, thus bringing into scope the fact that (a ~ Maybe v).
  Now when constructing the output function of type (a - Int) it may
  make use of this fact.
 
  -Brent
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 -- 
 Felipe.
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Second Call for Papers: Workshop on Functional Art, Music, Modeling, and Design (colocated with ICFP)

2013-05-22 Thread Brent Yorgey
Please submit something to FARM --- the deadline is fast approaching!

==
  FARM 2013: Call for Papers

  ACM SIGPLAN Workshop on Functional Art, Music, Modeling and Design
  Boston, Massachusetts, USA
  28th September, 2013 (directly after ICFP)

  http://www.cis.upenn.edu/~byorgey/farm13/
==

Scope
-

The functional programming community is largely interested in writing
beautiful programs. This workshop is intended to gather researchers and
practitioners interested in writing beautiful programs that generate
beautiful artifacts. Such artifacts may include visual art, music, 3D
sculptures, animations, GUIs, video games, physical models,
architectural models, choreographies for dance, poetry, and even
physical objects such as VLSI layouts, GPU configurations, or mechanical
engineering designs. The framework used need not be purely functional
(“mostly functional” is fine); may be based on abstractions such as
higher-order functions, monads, arrows, or streams; and may be
manifested as a domain specific language or tool. Theoretical
foundations, language design, implementation issues, and applications
are all within the scope of the workshop.

Important dates
---

  - Submissions due: Friday, 14 June 2013, 23:59 UTC-11 (American Samoa
time [1])

  - Author notification: Thursday, 11 July 2013

  - Final papers due: Thursday, 25 July 2013

  - Workshop: Saturday, 28 September 2013 (the day after ICFP)

[1] 
http://www.timeanddate.com/worldclock/fixedtime.html?msg=FARM+submissions+dueiso=20130614T2355p1=1033

Proceedings
---

There will be a formal proceedings published by ACM Press. Accepted
papers will be included in the ACM Digital Library; see
http://authors.acm.org/main.cfm for information on the options available
to authors. Authors are also encouraged to submit auxiliary material for
publication along with their paper (source code, data, videos, images,
etc.); authors retain all rights to the auxiliary material.

Submission details
--

We solicit submissions in two categories:

  - Full papers. A full paper is limited to 12 pages, and will be
evaluated according to its relevance, correctness, significance,
originality, and clarity. It should explain its contributions,
identify what has been accomplished, explain why it is significant,
and compare it with previous work.

  - Aesthetic applications. An aesthetic application paper is limited
to 6 pages, and will be judged primarily on the effective and
elegant use of FP to generate aesthetic artifacts (though the
criteria for full papers are still relevant).

Submitted papers should be in portable document format (PDF), formatted
using the ACM SIGPLAN style guidelines. The text should be in a 9-point
font in two columns.

Submissions can be made via EasyChair at

  https://www.easychair.org/conferences/?conf=farm2013

Organizers
--

Workshop Chair: Paul Hudak
Program Chair: Conal Elliott
Publicity Chair: Brent Yorgey

Program Committee
-

Daniel Cukier (University of São Paulo)
Conal Elliott (Tabula) (chair)
Kathleen Fisher (Tufts University)
Richard Gabriel (IBM Research)
George Giorgidze (University of Tübingen)
Paul Hudak (Yale University)
José Pedro Magalhães (University of Oxford)
Alex McLean (University of Leeds)
John Peterson (Western State Colorado University)
Michael Sperber (Active Group)
Henning Thielemann
Brent Yorgey (University of Pennsylvania)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Yi Google summer of code project

2013-04-23 Thread Brent Yorgey
Generally, for a successful proposal you need to already find someone
who is willing to mentor the project.

Honestly, I do not think working on Yi would make for a very strong
proposal.  It is definitely a cool piece of software, and definitely
worth working on, but it does not have a very large userbase and so
the benefit of this project to the Haskell community would be small.

-Brent

On Mon, Apr 22, 2013 at 02:12:02PM -0400, Gmail wrote:
 Hello again,
 
 I forgot to ask if I need to find myself a mentor or one will be
 assigned to me by haskell.org?
 
 Many thanks,
 
 Bastien
 
 On 4/21/13 5:57 PM, Bastien Jacot-Guillarmod wrote:
 Hello,
 
 I'm interested in doing some improvments on the Yi editor for my Google
 summer of code by implementing a completion pop up list for any buffer and a
 smart completion for haskell.
 
 But I don't really know if this kind of project could be acceptable, for the
 following reason:
 
 1) Should a GSoC project be mostly a working experience or also a learning
 one? I am not the most seasoned haskell programmer, but I really which to
 dive into a real-life project in this language.
 
 2) Is it too long, too small? I don't have too many years of programmation
 in haskell behind me even if I have done some functionnal programming in
 other languages (Scala most of the time), hence I don't want to take
 something that will be overwhelming.
 
 3) is Yi associated with haskell.org or it is not possible to have a project
 on Yi while being mentored by haskell?
 
 Thanks for your insight!
 
 Regards,
 Bastien Jacot-Guillarmod, 3rd CS bachelor student at EPFL (Lausanne)
 
 
 
 
 --
 View this message in context: 
 http://haskell.1045720.n5.nabble.com/Yi-Google-summer-of-code-project-tp5729090.html
 Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haskell compilation errors break the complexity encapsulation on DSLs

2013-04-23 Thread Brent Yorgey
On Tue, Apr 23, 2013 at 12:49:59PM +0200, Alberto G. Corona  wrote:
 Hi
 
 I ever was worried about the barrier that the complexity of the Haskell
 errors impose to users of DSLs. Many DSLs look so simple that even someone
 without knowledge of Haskell can make use of them for some domains.
 
 However when the program is compiled then al the monsters of the
 deep appear in the surface: polymorphisms, undefined instances, type errors
 reported in a line produced by a type assumption in another,  etc. This is
 a problem for an industrial use of Haskell in the large scale. For obvious
 reasons.

Indeed.  For example, in my experience this is a big problem for diagrams.

 
 
 The question: Is it possible to develop a GHC extension that attach (or
 prepend) such an explanation to the ghc error?
 
 Or any other alternative that carry out the same functionality.

Surely it is possible.  I have wanted this too.  I guess the majority
of the work would just be in coming up with a good, general design
which is useful but not too difficult to implement.  If anyone wanted
to undertake such a project I would be happy to contribute some ideas.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Unbound: rebind and unrebind

2013-04-22 Thread Brent Yorgey
Hi Eric,

On Sun, Apr 14, 2013 at 10:57:43AM -0700, Eric Dobson wrote:
 I am working at reimplementing the library Unbound to understand how
 it works. One issue I have come up with is that an equation that I
 thought held true doesn't. The equation is: Forall e::Rebind a b, e
 `aeq` (uncurry rebind . unrebind $ e) = True. That is that spliting
 the binding of a rebind and then adding it back should be the
 identity. The issue is that Rebind does not freshen its pattern
 variables on unrebind, because it assumes that a higher level unbind
 already did that if required. But I believe this is not sufficient as
 there is not necesarily a higher level Bind to be ubound as shown by
 this program:

You're right that you *can* write a program involving a Rebind without
a higher level Bind.  But you *should not*.  This is explained in the
documentation [1] and in the paper [2]. Briefly, there are two classes of types,
term types and pattern types.  You should only use term types to
represent data in your programs.  Rebind constructs a pattern type,
and as such should only be used in the context of an enclosing Bind.
It would be much nicer if we were able to track this distinction
directly in Haskell's type system and somehow prevent users from using
pattern types directly, but we do not know of a way to do this.

-Brent

[1] 
http://hackage.haskell.org/packages/archive/unbound/0.4.1.1/doc/html/Unbound-LocallyNameless.html#g:4

[2] Stephanie Weirich, Brent A. Yorgey, and Tim Sheard. Binders
Unbound. ICFP'11, September 2011, Tokyo,
Japan. http://www.cis.upenn.edu/~byorgey/papers/binders-unbound.pdf.

 
 {-# LANGUAGE TemplateHaskell, UndecidableInstances,
   FlexibleInstances, MultiParamTypeClasses #-}
 module Main where
 
 import Unbound.LocallyNameless
 
 data Exp = Var (Name Exp) deriving Show
 $(derive [''Exp])
 
 instance Alpha Exp
 
 instance Subst Exp Exp where
isvar (Var x) = Just (SubstName x)
 
 x :: Name Exp
 x = string2Name x
 
 y :: Name Exp
 y = string2Name y
 
 
 rebindPass :: Alpha a = Rebind Exp a - Rebind Exp a
 rebindPass = (uncurry rebind . unrebind)
 
 main :: IO ()
 main = do
   let rebound = (rebind (Var y) (Embed (Var x)))
   print $ rebound
   let substed = subst x (Var y) rebound
   print $ substed
   print $ unrebind substed
   print $ rebindPass substed
 
 Which outputs:
 Var y {Var x}
 Var y {Var y}
 (Var y,{Var y})
 Var y {Var 0@0}
 
 If the equation holds true then the second and fourth lines should be
 identical but they are not. Can someone explain why this is the
 correct behavior or if the implementation is incorrect?
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Call for Papers: Workshop on Functional Art, Music, Modeling, and Design (colocated with ICFP)

2013-04-17 Thread Brent Yorgey
==
  FARM 2013: Call for Papers

  ACM SIGPLAN Workshop on Functional Art, Music, Modeling and Design
  Boston, Massachusetts, USA
  28th September, 2013 (directly after ICFP)

  http://www.cis.upenn.edu/~byorgey/farm13/
==

Scope
-

The functional programming community is largely interested in writing
beautiful programs. This workshop is intended to gather researchers and
practitioners interested in writing beautiful programs that generate
beautiful artifacts. Such artifacts may include visual art, music, 3D
sculptures, animations, GUIs, video games, physical models,
architectural models, choreographies for dance, poetry, and even
physical objects such as VLSI layouts, GPU configurations, or mechanical
engineering designs. The framework used need not be purely functional
(“mostly functional” is fine); may be based on abstractions such as
higher-order functions, monads, arrows, or streams; and may be
manifested as a domain specific language or tool. Theoretical
foundations, language design, implementation issues, and applications
are all within the scope of the workshop.

Important dates
---

  - Submissions due: Friday, 14 June 2013, 23:59 UTC-11 (American Samoa
time [1])

  - Author notification: Thursday, 11 July 2013

  - Final papers due: Thursday, 25 July 2013

  - Workshop: Saturday, 28 September 2013 (the day after ICFP)

[1] 
http://www.timeanddate.com/worldclock/fixedtime.html?msg=FARM+submissions+dueiso=20130614T2355p1=1033

Proceedings
---

There will be a formal proceedings published by ACM Press. Accepted
papers will be included in the ACM Digital Library; see
http://authors.acm.org/main.cfm for information on the options available
to authors. Authors are also encouraged to submit auxiliary material for
publication along with their paper (source code, data, videos, images,
etc.); authors retain all rights to the auxiliary material.

Submission details
--

We solicit submissions in two categories:

  - Full papers. A full paper is limited to 12 pages, and will be
evaluated according to its relevance, correctness, significance,
originality, and clarity. It should explain its contributions,
identify what has been accomplished, explain why it is significant,
and compare it with previous work.

  - Aesthetic applications. An aesthetic application paper is limited
to 6 pages, and will be judged primarily on the effective and
elegant use of FP to generate aesthetic artifacts (though the
criteria for full papers are still relevant).

Submitted papers should be in portable document format (PDF), formatted
using the ACM SIGPLAN style guidelines. The text should be in a 9-point
font in two columns.

Submissions can be made via EasyChair at

  https://www.easychair.org/conferences/?conf=farm2013

Organizers
--

Workshop Chair: Paul Hudak
Program Chair: Conal Elliott
Publicity Chair: Brent Yorgey

Program Committee
-

Daniel Cukier (AgileAndArt)
Conal Elliott (Tabula) (chair)
Kathleen Fisher (Tufts University)
Richard Gabriel (IBM Research)
George Giorgidze (University of Tübingen)
Paul Hudak (Yale University)
José Pedro Magalhães (University of Oxford)
Alex McLean (ICSRiM)
John Peterson (Western State Colorado University)
Michael Sperber (Active Group)
Henning Thielemann (Martin-Luther-Universität Halle-Wittenberg)
Brent Yorgey (University of Pennsylvania)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ANN: adobe-swatch-exchange-0.1.0.0

2013-04-04 Thread Brent Yorgey
(Redirecting follow-up to haskell-cafe)

Very cool!  I have been hoping someone will find a way to integrate
kuler.adobe.com with diagrams, and this will help a lot. =)

  https://github.com/diagrams/diagrams-lib/issues/77

-Brent

On Wed, Apr 03, 2013 at 06:49:34PM -0500, Jeremy Shaw wrote:
 I am pleased to annouce the release of adobe-swatch-exchange 0.1.0.0.
 
 My primary motivation in writing this is to make it easier to download
 color swatches from http://kuler.adobe.com/ and test them on my site.
 Though, perhaps there is already a great way of doing this and I
 didn't look hard enough.
 
 But, the end result is we can now read and write .ASE files in Haskell
 and convert them to .css. So that probably opens up some new
 possibilities.
 
 I have provided both a library and an executable.
 
 I have also used this as a way to test the waters with github,
 
 https://github.com/stepcut/ase2css
 
 I heard putting things on github will get me all sorts of
 contributors. I suggest someone start with haddock comments. ;)
 
 Cheers!
 - jeremy
 
 ___
 Haskell mailing list
 hask...@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal install pandoc

2013-03-31 Thread Brent Yorgey
On Fri, Mar 29, 2013 at 08:05:47AM -0230, Roger Mason wrote:
 Thank you for your response.  'ghc-pkg check' shows some problems:
 
 http://pastebin.ca/2344794
 
 On 03/28/2013 08:01 PM, Patrick Wheeler wrote:
 So I printed off the requirements for pandoc on a empty ghc-7.6.2
 install you can find it at:
 http://hpaste.org/84794
 
 I do not see any odd package versions listed in what you posted so far.
 
 No promise I will be able to help afterwards but it might help to
 see the full log, and then again with verbosity turned on. So
 seperate pastes for:
 
 * `cabal install pandoc --dry-run`
 * `cabal install pandoc --dry-run --verbose=2`
 * `cabal install pandoc --dry-run --verbose=3`
 
 You might also want to run a `ghc-pkg check` to check to see if
 your packages are consistent/unbroken.
 
 
 'ghc-pkg check' shows some problems:
 
 http://pastebin.ca/2344794
 

It looks like your entire Haskell Platform installation is completely
hosed.  Sad to say, but I think your best bet is to simply reinstall
the Haskell Platform.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Enumerating functions at runtime

2013-03-24 Thread Brent Yorgey
On Sat, Mar 23, 2013 at 08:26:52PM -0700, Luke Evans wrote:
 I'm curious about using Haskell for metaprogramming.
 
 It looks like I can dynamically compile, load and run some Haskell with the 
 plugins package.  Actually I've briefly tried this and it seems to work for 
 some simple cases at least.
 Now I would like to be able to enumerate precompiled public functions in 
 modules that I might use as building blocks in such dynamic compilation.  So 
 far I'm not seeing anything that does this directly.
 Can anyone provide some pointers?
 
 If it's just not possible to introspect on compiled modules, then I suppose I 
 could use external metadata of my own, or even perhaps haddock info if it 
 exists, to attempt to generate this info.  Clearly though, that's nowhere 
 near as good as extracting the info from something the compiler built 
 directly.

I have no idea how it works, but I'm pretty sure yi does this ---
e.g. if you hit M-x (when in emacs emulation mode) and then
tab-complete, you see a list of all the available functions.  Maybe
you want to take a look at the yi source code and see how they do it.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Excercise on tagless final interpreters

2013-03-21 Thread Brent Yorgey
On Thu, Mar 21, 2013 at 11:32:21AM +0100, matteo vezzola wrote:
 I'm playing with tagless final interpreters reading [1], using a very simple 
 language:
 
  class Ints repr where
  int :: Integer - repr Integer
  (.+.) :: repr Integer - repr Integer - repr Integer
  (.*.) :: repr Integer - repr Integer - repr Integer
  (.-.) :: repr Integer - repr Integer
  (.=.) :: repr Integer - repr Integer - repr Bool
 
  newtype P repr t = P { unP :: Bool - repr t }
  instance Ints repr = Ints (P repr) where
  int n = P $ \ s - if s then int n else (.-.) (int n)
  (.-.) n = P $ unP n . not
  n .+. m = P $ \ s - unP n s .+. unP m s

  n .*. m = P $ \ s - unP n s .*. unP m s
  n .=. m = P $ \ s - unP n s .=. unP m s

Incidentally, these last two lines seem wrong.  It is not the case
that -(n*m) = (-n)*(-m) or that  n = m  iff  (-n) = (-m).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question about data declaration

2013-03-21 Thread Brent Yorgey
On Thu, Mar 21, 2013 at 06:18:46PM +0530, C K Kashyap wrote:
 Hi,
 
 I have a situation where I need to define a data type T such that
 
 data T = C1 Int | C2 Char | C3 T
 
 However, I want to enforce a constraint that C3 only allows (C2 Char) and
 not (C1 Int). That is

If C3 should only be able to hold a C2 Char, then why have it hold a T
at all?  i.e. why not

  data T = C1 Int | C2 Char | C3 Char

but I suppose your real problem is probably more complicated, in which
case I would recommend using a GADT as others have suggested.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Open-source projects for beginning Haskell students?

2013-03-11 Thread Brent Yorgey
On Mon, Mar 11, 2013 at 11:50:38AM -0700, Ben wrote:
 
 On Mar 11, 2013, at 11:26 AM, Jason Dagit wrote:
 
  Myself and several of my friends would find it useful to have a plotting 
  library that we can use from ghci to quickly/easily visualize data. 
  Especially if that data is part of a simulation we are toying with. 
  Therefore, this proposal is for: A gnuplot-, matlab- or plotinum-like 
  plotting API (that uses diagrams as the backend?). The things to emphasize:
* Easy to install: No gtk2hs requirement. Preferably just pure haskell 
  code and similar for any dependencies. Must be cross platform.
* Frontend: graphs should be easy to construct; customizability is not as 
  important
* Backend: options for generating static images are nice, but for the use 
  case we have in mind also being able to render in a window from ghci is 
  very valuable. (this could imply something as purely rendering to 
  JuicyPixels and I could write the rendering code)
   
  * What I would hope from you is a willingness to exchange email and/or
chat with the student(s) over the course of the project, to give
them a bit of guidance/mentoring.  I am certainly willing to help on
that front, but of course I probably don't know much about your
particular project.
  
  I am willing/able to take on the mentoring aspect :)
 
 i second this, but with a different emphasis.  i would like a ggplot2-type 
 DSL for generating graphs, for data analysis and exploration.  i agree with :
 
 * it would be great to have no gtk2hs / cairo requirement.  (i guess this 
 means text rendering in the diagrams-svg backend needs to be solved.)  i 
 guess in the near-term, this is less important to me -- having a proper 
 plotting DSL at all is an important start.
 
 * frontend : graphs should be easy to construct, but having some flexibility 
 is important.  the application here is being able to explore statistical 
 data, with slicing, grouping, highlighting, faceting, etc.
 
 * backend : static images are enough for me, interactive is a plus.  most 
 importantly : it should be fast enough to work pleasantly with large 
 datasets.  ggplot2 is pretty awesome but kills my machine, routinely.

Not to throw cold water on these ideas (which sound fantastic!), but
the scope of this sounds more like a GSoC project than something a
beginner could accomplish in 10-15 hours in the space of a few weeks.
I'm looking not for project ideas but for small, concrete
contributions they could make to existing open source projects.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-04 Thread Brent Yorgey
On Sun, Mar 03, 2013 at 05:38:02PM -0800, bri...@aracnet.com wrote:
 On Sun, 3 Mar 2013 19:58:37 -0500
 Brent Yorgey byor...@seas.upenn.edu wrote:
 
  
  Good access to fonts and font metrics is the kicker.  Otherwise I'd
  say to switch to using diagrams as a backend, hence getting a whole
  bunch of actual backends for free.  I would love to see development of
  some good Haskell font packages -- maybe it would even make a good
  GSoC project?  Unfortunately I don't know enough about it to even know
  what would be involved, or how much work it would be.
  
 
 I assume that to use diagram the font package would have to be a vector font 
 system, or could bit-mapped fonts be used ?

A vector font system would be ideal, as then you could go crazy
turning glyphs into paths and doing whatever the heck you want with
them using the diagrams framework.  However, bit-mapped fonts could be
used too (as long as there is a backend to support them), it would
just be less useful.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-04 Thread Brent Yorgey
On Mon, Mar 04, 2013 at 02:30:55PM -0800, bri...@aracnet.com wrote:
 On Mon, 4 Mar 2013 17:27:29 -0500
 Brent Yorgey byor...@seas.upenn.edu wrote:
 
  On Sun, Mar 03, 2013 at 05:38:02PM -0800, bri...@aracnet.com wrote:
   On Sun, 3 Mar 2013 19:58:37 -0500
   Brent Yorgey byor...@seas.upenn.edu wrote:
   

Good access to fonts and font metrics is the kicker.  Otherwise I'd
say to switch to using diagrams as a backend, hence getting a whole
bunch of actual backends for free.  I would love to see development of
some good Haskell font packages -- maybe it would even make a good
GSoC project?  Unfortunately I don't know enough about it to even know
what would be involved, or how much work it would be.

   
   I assume that to use diagram the font package would have to be a vector 
   font system, or could bit-mapped fonts be used ?
  
  A vector font system would be ideal, as then you could go crazy
  turning glyphs into paths and doing whatever the heck you want with
  them using the diagrams framework.  However, bit-mapped fonts could be
  used too (as long as there is a backend to support them), it would
  just be less useful.
  
 
 yes - seems to me that vector fonts are definitely the way to go.
 
 it seems like this problem has to already have a solution.  maybe all that's 
 needed is a font importer which understands some, already established, vector 
 font  representation.
 

Well, there is the SVGFonts package:

  http://hackage.haskell.org/package/SVGFonts

I don't have a good sense of how widely supported this representation
is, or how easy it is to convert between it and other font
representations.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-03 Thread Brent Yorgey
On Sun, Mar 03, 2013 at 09:22:15PM +0100, Arnaud Bailly wrote:
 Hello,
 I am trying to install timeplot and splot on a windows 7 host, using
 Haskell platform 2012.2.0.0, and I have troubles installing HSChart.
 
 First difficulties were installing cairo, which requires Gtk+ libraries and
 headers. I installed those using a Gtk+-bundle, first in c:\Program Files\.
 I had to move to d:\soft (eg. a directory without spaces) to be able to
 install cairo.
 
 Then I tried to install Chart and at first failed with a cryptic 'Exit
 Failure 1' error from cabal. I succeeded when I redirected cabal output to
 a file, eg: cabal install  out 21 whereas a plain 'cabal install' failed.
 
 Then I managed to install splot and timeplot. I then tried to use Chart to
 draw a simple chart, following
 http://hackage.haskell.org/packages/archive/Chart/0.16/doc/html/Graphics-Rendering-Chart-Simple.htmland
 it hang forever with a CPU at 100%.

No idea if it's related, but hanging forever with the CPU at 100%
reminds me of this:

  http://code.google.com/p/diagrams/issues/detail?id=71

Unfortunately, GTK + cairo are notoriously difficult to install on
OSX and Windows.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Trouble installing and using Chart/cairo on windows 7

2013-03-03 Thread Brent Yorgey
On Mon, Mar 04, 2013 at 11:26:23AM +1100, Tim Docker wrote:
 On 04/03/13 07:22, Arnaud Bailly wrote:
 Then I managed to install splot and timeplot. I then tried to use
 Chart to draw a simple chart, following 
 http://hackage.haskell.org/packages/archive/Chart/0.16/doc/html/Graphics-Rendering-Chart-Simple.html
 and it hang forever with a CPU at 100%.
 
 As the author of the Chart library, I'm sorry to say I don't know.
 Chart is developed under linux, and I do occasional testing under
 osx, but I don't use windows at all. Chart is a pure haskell library
 sitting over cairo, so it is most likely a cairo problem rather than
 a chart one, but I realise this doesn't help you.
 
 Do the examples that come with the haskell binding to cairo work for you?
 
 Windows and gtk continues to be problematic for many users. I'd love
 to see an alternative backend for the chart library, but I would need
 a graphics API that installs easily under windows, osx and linux, and
 provides good access to fonts and font metrics. Any suggestions?

Good access to fonts and font metrics is the kicker.  Otherwise I'd
say to switch to using diagrams as a backend, hence getting a whole
bunch of actual backends for free.  I would love to see development of
some good Haskell font packages -- maybe it would even make a good
GSoC project?  Unfortunately I don't know enough about it to even know
what would be involved, or how much work it would be.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Split and substitution using regex-pcre

2013-02-28 Thread Brent Yorgey
On Fri, Mar 01, 2013 at 08:30:20AM +1300, Alistair Bayley wrote:
 You cannot bend the split package to your needs?
 http://hackage.haskell.org/packages/archive/split/0.2.1.2/doc/html/Data-List-Split.html
 
 Some combination of splitWhen and a pcre-based predicate?

This won't work; splitWhen operates only on single list elements, not
on substrings.

-Brent

 On 24 February 2013 22:44, Simon Marechal si...@banquise.net wrote:
 
  I could not find the perl-equivalents of these functions on Hackage, so
  I quickly wrote mine. Code is there:
 
  https://github.com/bartavelle/pcre-utils
 
  It should behave like perl (not really tested actually), and do strange
  things like :
 
   splitCompile a b
  Right [b]
   splitCompile a baaa
  Right [b]
 
  This will go on Hackage as I need it for the language-puppet package,
  but I am interested in comments, especially concerning the namespaces:
  * is the name of this package OK ?
  * is the name of the package OK ?
  * should I work with the regex-pcre maintainer to try to merge it ?
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal install ghc-mod installs 3 years old version

2013-02-25 Thread Brent Yorgey
On Sun, Feb 24, 2013 at 02:33:55PM +, Niklas Hambüchen wrote:
 You are right, my ghc-7.4.2 was broken in ghc-pkg list; I fixed the
 problem by killing my .cabal folder (as so often).

Surely you mean by killing your .ghc folder?  I do not see what effect
killing your .cabal folder could possibly have on broken packages.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2013-02-23 Thread Brent Yorgey
On Fri, Feb 22, 2013 at 06:44:06PM +0100, Corentin Dupont wrote:
 Hi all,
 I have a program able to read another program as a string, and interpret it
 (using Hint).
 I'd like to make unit tests, so I have a file Test.hs containing a serie
 of test programs as strings.
 However, how could I be sure that these test program are syntactically
 valid, at compile time?

If you just want to check whether a program is syntactically valid,
you can use the haskell-src-exts package to parse it.  If you also
want to do some type checking you can try the haskell-type-exts
package.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Hackage suggestion: Gather the list of the licenses of all dependencies of a package

2012-12-15 Thread Brent Yorgey
On Sat, Dec 15, 2012 at 08:13:44AM +0100, Petr P wrote:
 This is strange, I thought that cpphs should be specified in
 build-tools:, not in build-depends:.
 
 http://www.haskell.org/cabal/users-guide/developing-packages.html#build-information
 
 
 Best regards,
 Petr

Presumably the reason to list it in build-depends instead of
build-tools is that in the latter case cabal will not automatically
install it as a dependency.  But you are right that this is a strange
situation, since if it is being used only as a preprocessor,
semantically it ought to be listed in build-tools.

-Brent

 2012/12/13 Michael Snoyman mich...@snoyman.com
 
 
 
 
  On Thu, Dec 13, 2012 at 9:51 PM, Daniel Trstenjak 
  daniel.trsten...@gmail.com wrote:
 
 
  On Thu, Dec 13, 2012 at 08:40:09PM +0200, Michael Snoyman wrote:
   If you have a commercial use for cpphs, and feel the terms of the (L)GPL
   are too onerous, you have the option of distributing unmodified binaries
   (only, not sources) under the terms of a different licence (see
   LICENCE-commercial).
 
  I think that depedencies to binaries, like cpphs, should be treated
  differently than depedencies to libraries, because using a (L)GPL-ed
  binary mostly hasn't any implications for a commercial user and
  also for the output of a (L)GPL-ed binary usually the (L)GPL doesn't
  apply.
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
  In the case of cpphs, there's no way to determine that we're using it as a
  library or an executable, since it's just listed in the build-depends.
 
  Michael
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: diagrams-0.6

2012-12-11 Thread Brent Yorgey
I am pleased to announce the release of version 0.6 of diagrams [1], a
full-featured framework and embedded domain-specific language for
declarative drawing. Check out the gallery [2] for examples of what it
can do! [3,4]

[1] http://projects.haskell.org/diagrams  
[2] http://projects.haskell.org/diagrams/gallery.html  
[3] http://mathlesstraveled.com/2012/11/05/more-factorization-diagrams/  
[4] http://projects.haskell.org/diagrams/gallery/PythagoreanTree.html  

Highlights of this release include:

-   Diagrams now comes with a native-Haskell SVG backend [5] by default.
If you were holding off on trying diagrams because you couldn't
install cairo, you no longer have an excuse!

-   Proper support for subdiagrams: previous versions of diagrams-core
had a mechanism for associating names with a pair of a location and
an envelope. Now, names are associated with actual subdiagrams
(including their location and envelope, along with all the other
information stored by a diagram). This enables cool techniques like
constructing a diagram in order to position its subelements and then
taking it apart again, or constructing animations via keyframing.

-   Traces: in addition to an envelope, each diagram now stores a
trace, which is like an embedded raytracer: given any ray
(represented by a base point and a vector), the trace computes the
closest point of intersection with the diagram along the ray. This
is useful for determining points on the boundary of a diagram, e.g.
when drawing arrows between diagrams.

-   The core data structure underlying diagrams has been completely
refactored and split out into its own separate package, dual-tree
[6].

-   Support for GHC 7.6.

-   Many more new features, bug fixes, and improvements! See the release
notes [7] for complete details, and the diagrams wiki [8] for help
migrating from 0.5 to 0.6.

[5] http://hackage.haskell.org/package/diagrams%2Dsvg  
[6] http://hackage.haskell.org/package/dual%2Dtree  
[7] http://projects.haskell.org/diagrams/releases.html  

Try it out
--

For the truly impatient:

cabal install diagrams

Diagrams is supported under GHC 7.0 through 7.6, with the exception that
the cairo and gtk backends do not build under GHC 7.0 (but the SVG
backend does), and the gtk backend does not build under GHC 7.6.

To get started with diagrams, read the quick tutorial [9], which will
introduce you to the fundamentals of the framework.

For those who are less impatient and want to really dig in and use the
power features, read the user manual [10].

[8] http://www.haskell.org/haskellwiki/Diagrams/Migrate0.6  
[9] http://projects.haskell.org/diagrams/tutorial/DiagramsTutorial.html  
[10] http://projects.haskell.org/manual/diagrams-manual.html  

Get involved


Subscribe to the project mailing list [11], and/or come hang out in the
#diagrams IRC channel on freenode.org for help and discussion. Make some
diagrams. Fix some bugs [12]. Submit your cool examples for inclusion in
the gallery [13] or your cool code for inclusion in the diagrams-contrib
[14] package!

[11] http://groups.google.com/group/diagrams-discuss  
[12] http://github.com/diagrams/  
[13] http://projects.haskell.org/diagrams/gallery.html  
[14] http://hackage.haskell.org/package/diagrams%2Dcontrib

Happy diagramming!

Brought to you by the diagrams team:

-   Michael Sloan
-   Ryan Yates
-   Brent Yorgey

with contributions from:

-   Sam Griffin
-   Niklas Haas
-   Peter Hall
-   Claude Heiland-Allen
-   Deepak Jois
-   John Lato
-   Felipe Lessa
-   Chris Mears
-   Ian Ross
-   Vilhelm Sjöberg
-   Jim Snavely
-   Luite Stegeman
-   Kanchalai Suveepattananont
-   Michael Thompson
-   Scott Walck

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Maintainer of fixpoint

2012-12-06 Thread Brent Yorgey
On Wed, Dec 05, 2012 at 08:22:32PM +0100, Petr P wrote:
Dear Haskellers,
 
 I've made some minor improvements of fixpoint package 
 http://hackage.haskell.org/package/fixpoint. I tried to contact the
 original maintainer twice, but without success. The package hasn't been
 updated for 4 years. How should I proceed? Should I start a new fork of the
 package? Or is there a way how to take over an orphaned package?
 
   Thanks for help,
   Petr Pudlak

I should also point out that I think the (much more recent)
recursion-schemes package implements everything in 'fixpoint' and a
lot more besides.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Design of a DSL in Haskell

2012-12-03 Thread Brent Yorgey
(Sorry, forgot to reply to the list initially; see conversation below.)

On Mon, Dec 03, 2012 at 03:49:00PM +0100, Joerg Fritsch wrote:
 Brent,

 I believe that inside the do-block (that basically calls my
 interpreter) I cannot call any other Haskell function that are not
 recognized by my parser and interpreter.

This seems to just require some sort of escape mechanism for
embedding arbitrary Haskell code into your language.  For example a
primitive

  embed :: a - CWMWL a

(assuming CWMWL is the name of your monad).  Whether this makes sense,
how to implement embed, etc. depends entirely on your language and
interpreter.  

However, as you imply below, this may or may not be possible depending
on the type a.  In that case I suggest making embed a type class method.
Something like

  class Embeddable a where
embed :: a - CWMWL a

I still get the feeling, though, that I have not really understood
your question.

 I am also trying to learn how I could preserve state from one line
 of code of my DSL to the next. I understand that inside the
 interpreter one would use a combination of the state monad and the
 reader monad, but could not find any non trivial example.

Yes, you can use the state monad to preserve state from one line to
the next.  I am not sure what you mean by using a combination of state
and reader monads.  There is nothing magical about the combination.
You would use state + reader simply if you had some mutable state as
well as some read-only configuration to thread through your
interpreter.

xmonad is certainly a nontrivial example but perhaps it is a bit *too*
nontrivial.  If I think of any other good examples I'll let you know.

-Brent

 
 
 On Dec 3, 2012, at 1:23 PM, Brent Yorgey wrote:
 
  On Sun, Dec 02, 2012 at 03:01:46PM +0100, Joerg Fritsch wrote:
  This is probably a very basic question.
  
  I am working on a DSL that eventuyally would allow me to say:
  
  import language.cwmwl
  main = runCWMWL $ do
 eval (isFib::, 1000, ?BOOL)
  
  I have just started to work on the interpreter-function runCWMWL and I 
  wonder whether it is possible to escape to real Haskell somehow (and how?) 
  either inside ot outside the do-block.
  
  I don't think I understand the question.  The above already *is* real
  Haskell.  What is there to escape?
  
  I thought of providing a defautl-wrapper for some required prelude
  functions (such as print) inside my interpreter but I wonder if
  there are more elegant ways to co-loacate a DSL and Haskell without
  falling back to being a normal library only.
  
  I don't understand this sentence either.  Can you explain what you are
  trying to do in more detail?
  
  -Brent
 
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-11-30 Thread Brent Yorgey
On Fri, Nov 30, 2012 at 02:33:54AM +0100, Ben Franksen wrote:
 Brent Yorgey wrote:
  On Thu, Nov 29, 2012 at 03:52:58AM +0100, Ben Franksen wrote:
  Tony Morris wrote:
   As a side note, I think a direct superclass of Functor for Monad is not
   a good idea, just sayin'
   
   class Functor f where
 fmap :: (a - b) - f a - f b
   
   class Functor f = Apply f where
 (*) :: f (a - b) - f a - f b
   
   class Apply f = Bind f where
 (=) :: (a - f b) - f a - f b
   
   class Apply f = Applicative f where
 unit :: a - f a
   
   class (Applicative f, Bind f) = Monad f where
   
   Same goes for Comonad (e.g. [] has (=) but not counit)
   ... and again for Monoid, Category, I could go on...
  
  Hi Tony
  
  even though I dismissed your mentioning this on the Haskell' list, I do 
 have 
  to admit that the proposal has a certain elegance. However, before I buy 
  into this scheme, I'd like to see some striking examples for types with 
  natural (or at least useful) Apply and Bind instances that cannot be made 
  Applicative resp. Monad. 
  
  Try writing an Applicative instances for (Data.Map.Map k).  It can't
  be done, but the Apply instance is (I would argue) both natural and 
 useful.
 
 I see. So there is one example. Are there more? I'd like to get a feeling 
 for the abstraction and this is hard if there is only a single example.

Any data type which admits structures of arbitrary but *only finite*
size has a natural zippy Apply instance but no Applicative (since
pure would have to be an infinite structure).  The Map instance I
mentioned above falls in this category.  Though I guess I'm having
trouble coming up with other examples, but I'm sure some exist.  Maybe
Edward knows of other examples.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] lambda case

2012-11-30 Thread Brent Yorgey
Oh, PLEASE people.  Let's not have another round of bikeshedding about
this AFTER the feature is already implemented!

-Brent

On Fri, Nov 30, 2012 at 01:25:27PM +0100, Herbert Valerio Riedel wrote:
 Jon Fairbairn jon.fairba...@cl.cam.ac.uk writes:
 
 [...]
 
  “\case” complicates lambda, using “of” simply breaks “case … of …”
  into two easily understood parts.
 
 Just some observation (I'm rather late to the lambda-case discussion, so
 this might have been already pointed out previously):
 
 if the reserved keyword 'of' was to take the place of '\case', shouldn't
 then
 
   'case' exp
 
 w/o the 'of' { alts }-part become a separately valid expression (with
 'case' essentially meaning 'flip ($)') to really break it up into two
 independent parts? Then 'case exp of { alts }' wouldn't be a special
 form anymore, but would just result from combining 'case' and 'of';
 
 'case' wouldn't even need to be a reserved keyword (and thus the grammar
 could be simplified), if it wasn't for the current grammar which
 requires to isolate a \case-expression by using () or $, consider e.g.:
 
   {-# LANGUAGE LambdaCase #-}
   
   import System.Environment
   
   case' :: b - (b - c) - c
   case' = flip ($)
   
   main = do
 s - getArgs
   
 case' s $ \case  -- image '\case' was actually '\of' or 'of'
   [x] - putStrLn (Hello  ++ x)
   _   - putStrLn wrong number of arguments given
 
 
 just my 2¢
 
 cheers,
   hvr
 
 ___
 Glasgow-haskell-users mailing list
 glasgow-haskell-us...@haskell.org
 http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Why Kleisli composition is not in the Monad signature?

2012-11-29 Thread Brent Yorgey
On Thu, Nov 29, 2012 at 03:52:58AM +0100, Ben Franksen wrote:
 Tony Morris wrote:
  As a side note, I think a direct superclass of Functor for Monad is not
  a good idea, just sayin'
  
  class Functor f where
fmap :: (a - b) - f a - f b
  
  class Functor f = Apply f where
(*) :: f (a - b) - f a - f b
  
  class Apply f = Bind f where
(=) :: (a - f b) - f a - f b
  
  class Apply f = Applicative f where
unit :: a - f a
  
  class (Applicative f, Bind f) = Monad f where
  
  Same goes for Comonad (e.g. [] has (=) but not counit)
  ... and again for Monoid, Category, I could go on...
 
 Hi Tony
 
 even though I dismissed your mentioning this on the Haskell' list, I do have 
 to admit that the proposal has a certain elegance. However, before I buy 
 into this scheme, I'd like to see some striking examples for types with 
 natural (or at least useful) Apply and Bind instances that cannot be made 
 Applicative resp. Monad. 

Try writing an Applicative instances for (Data.Map.Map k).  It can't
be done, but the Apply instance is (I would argue) both natural and useful.

 Also, it is not clear to me what laws should hold 
 for them.

http://hackage.haskell.org/package/semigroupoids defines all of these
and specifies laws, presumably derived in a principled way.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] delete http://www.haskell.org/haskellwiki/Haskell_IDE

2012-11-28 Thread Brent Yorgey
On Wed, Nov 28, 2012 at 07:08:16PM +0200, Roman Beslik wrote:
 Hi. There is more verbose page
 http://www.haskell.org/haskellwiki/IDEs . I registered on
 http://www.haskell.org/haskellwiki/ , but have not found the Delete
 Page command, wiki software help pages, or feedback channel, so I'm
 writing here.

Deleting pages is rather drastic and not enabled for normal users.  It
is probably not a good idea anyway -- what if there are other pages
that link to it?  Just delete all the content and replace it with a
redirect to the IDEs page.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cabal configure cabal build cabal install

2012-11-25 Thread Brent Yorgey
On Sun, Nov 25, 2012 at 06:09:26PM -0500, Albert Y. C. Lai wrote:
 
 If you begin with cabal configure, the correct idiom is:
 
 cabal configure [flags]
 cabal build
 [cabal haddock, if you want]
 cabal copy
 cabal register

Even this does not do the same thing as 'cabal install', because it
does not download and install any dependencies (whereas 'cabal
install' does).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Taking over ghc-core

2012-11-16 Thread Brent Yorgey
On Fri, Nov 16, 2012 at 03:25:35PM -0500, Jay Sulzberger wrote:
 
 
 On Fri, 16 Nov 2012, Carter Schonwald carter.schonw...@gmail.com wrote:
 
 how would ghc-core enable targetting core for Agda?
 
 
 On Wed, Nov 14, 2012 at 6:32 PM, Andreas Abel andreas.a...@ifi.lmu.dewrote:
 
 Excellent!
 
 With ghc-core being maintained again, we can start thinking about
 compiling Agda to core instead of hs.
 
 Andreas
 
 I would like to be able to take the textual version of Core
 output by GHC and use that text as input to the next stage of
 compilation.
 
 oo--JS.

Note that the ghc-core package only does pretty-printing of GHC core.
Whether GHC can parse a textual representation of GHC core (like Jay
and, presumably, Andreas want) is unrelated to the ghc-core package.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] local type denotation

2012-11-14 Thread Brent Yorgey
Turn on the ScopedTypeVariables extension (e.g. by putting {-#
LANGUAGE ScopedTypeVariables #-} at the top of your file), and add an
explicit 'forall a.' to the type signature of f.

-Brent

On Wed, Nov 14, 2012 at 04:03:57PM +0400, Serge D. Mechveliani wrote:
 Please,
 how to correctly set an explicit type for a local value in the body of 
 a polymorphic function?
 
 Example (tested under  ghc-7.6.1):
 
   data D a = D1 a | D2 a (a - a)
 
   f :: Eq a = D a - a
   f (D1 x)   = x
   f (D2 x g) = let -- y :: Eq a = a
y = g x
in  if x == y then x else g y
 
   main = putStr $ shows (f (D2 (1 :: Int) succ)) \n

 
 This is compiled byghc --make Main
 
 Now I need, for a certain reason, to explicitly set the type for  y  in 
 `let',  with the meaning: 
 this very `a' which is in the signature for  f
 (and I think that this type Haskell assignes to  y  in  y = g x).
 
 I need to declare this type in a separate line:  y :: what ever it is.
 
 Both  `y :: a'  and  `y :: Eq a = a'  are not compiled.
 
 Please, copy the answer to  mech...@botik.ru
 
 Thanks,
 
 --
 Sergei
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Teaching Haskell @ MOOCs like Coursera or Udacity

2012-10-23 Thread Brent Yorgey
On Thu, Oct 18, 2012 at 11:49:08PM +0530, niket wrote:
 I am a novice in Haskell but I would love to see the gurus out here
 teaching Haskell on MOOCs like Coursera or Udacity.
 
 Dr Martin Odersky is doing it for Scala here:
 https://www.coursera.org/course/progfun
 
 I would love to see Haskell growing on such new platforms!

Just as a counterpoint, putting together a MOOC is a *ton* of work,
with (in my opinion) not much benefit for a topic like Haskell where
it is already possible to access lots of quality instructional
materials online.  I would rather see Haskell gurus put their time and
effort into producing more awesome code (or into curating existing
instructional materials).

Just my 2c.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Explicitly passing an argument to an arrow

2012-10-03 Thread Brent Yorgey
On Wed, Oct 03, 2012 at 10:41:25AM +0200, Alfredo Di Napoli wrote:
 Hello everyone,
 
 sorry for the dumb question but I'm wrapping my head around arrow just from
 this morning.
 Consider this toy function to swap argument of a tuple:
 
 swapA' :: (Arrow a) = a ((b,c), (b,c)) (c,b)
 swapA' = swapFirst  swapSecond
   where
 swapFirst  = first $ arr snd
 swapSecond = second $ arr fst
 
 
 It works but requires to pass a tuple of tuple, namely ((b,c), (b,c)).
 How can I explicitly pass my tuple of tuple to swapFirst so I can simply
 invoke
 
 swapA' (1,2)
 
 
 and get the correct result?

Like this?

  swapA' = dup  swapFirst  swapSecond
where
  dup = id  id
  ...

I'm afraid I'm not confident I really understand your question,
however, so if that doesn't answer it, try asking again!

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: New wiki page and mailing list for combinatorics and Haskell

2012-09-24 Thread Brent Yorgey
Quite a while ago there was a mailing list thread where the idea was
brought up of creating a mailing list for those interested in
combinatorics in the setting of Haskell.

Well, I've finally gotten around to it.  If you're interested in
(probably extremely low-traffic) discussion and announcements relating
to doing combinatorics in Haskell (computing combinatorial/
number-theoretic functions; exhaustive or random generation of
combinatorial objects; type algebra; etc.), please join!  

  http://projects.haskell.org/cgi-bin/mailman/listinfo/combinatorics

There is also a wiki page for collecting information here:

  http://www.haskell.org/haskellwiki/Combinatorics

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] guards in applicative style

2012-09-12 Thread Brent Yorgey
Lorenzo is correct, but actually for the wrong reason. =) The *type*
of guard is a historical accident, and the fact that it requires
MonadPlus doesn't really tell us anything.  Let's take a look at its
implementation:

  guard   :: (MonadPlus m) = Bool - m ()
  guard True  =  return ()
  guard False =  mzero

'return' is not specific to Monad; we could just as well use 'pure'.
'mzero' is a method of 'MonadPlus' but there is no reason we can't use
'empty' from the 'Alternative' class.  So we could define

  guardA :: Alternative f = Bool - f ()
  guardA True  = pure ()
  guardA False = empty

(As another example, consider the function 'sequence :: Monad m = [m
a] - m [a]'.  Actually this function does not need Monad at all, it
only needs Applicative.)

However, guardA is not as useful as guard, and it is not possible to
do the equivalent of the example shown using a list comprehension with
a guard.  The reason is that whereas monadic computations can make use
of intermediate computed values to decide what to do next, Applicative
computations cannot.  So there is no way to generate values for x and
y and then pass them to 'guardA' to do the filtering.  guardA can only
be used to conditionally abort an Applicative computation using
information *external* to the Applicative computation; it cannot
express a condition on the intermediate values computed by the
Applicative computation itself.

-Brent

On Wed, Sep 12, 2012 at 03:52:03PM +0100, Lorenzo Bolla wrote:
 I'm no expert at all, but I would say no.
 guard type is:
 guard :: MonadPlus m = Bool - m ()
 
 and MonadPlus is a monad plus (ehm...) mzero and mplus
 (http://en.wikibooks.org/wiki/Haskell/MonadPlus).
 On the other hand Applicative is less than a monad
 (http://www.haskell.org/haskellwiki/Applicative_functor), therefore
 guard as is cannot be defined.
 
 But, in your specific example, with lists, you can always use filter:
 filter (uncurry somePredicate) ((,) $ list1 * list2 (somePredicate ???))
 
 hth,
 L.
 
 
 On Wed, Sep 12, 2012 at 3:40 PM, felipe zapata tifonza...@gmail.com wrote:
 
  Hi Haskellers,
 
  Suppose I have two list and I want to calculate
  the cartesian product between the two of them,
  constrained to a predicate.
  In List comprehension notation is just
 
  result = [ (x, y) | x - list1, y -list2, somePredicate x y ]
 
  or in monadic notation
 
  result = do
   x - list1
   y - list2
   guard (somePredicate x y)
  return $ (x,y)
 
  Then I was wondering if we can do something similar using an applicative 
  style
 
  result = (,) $ list1 * list2 (somePredicate ???)
 
  The question is then,
  there is a way for defining a guard in applicative Style?
 
  Thanks in advance,
 
  Felipe Zapata.
 
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] package categories

2012-09-08 Thread Brent Yorgey
On Sat, Sep 08, 2012 at 11:04:34AM +0400, Sergey Mironov wrote:
 Hello list. Do we have a guideline for selecting correct category for
 a package being developed? I'd like to choose between Web.MyLib and
 Network.MyLib. Or probably just MyLib if I feel ambitious?
 Sergey.

MyLib is discouraged.  I'm sure either Web.MyLib or Network.MyLib
would be fine.  I don't know of any guidelines.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: grid-1.1

2012-09-06 Thread Brent Yorgey
On Thu, Sep 06, 2012 at 09:42:19AM +, Amy de Buitléir wrote:
 I'm happy to announce a new package called grid:
 
 http://hackage.haskell.org/package/grid
 https://github.com/mhwombat/grid/wiki (wiki)

Looks neat!  By the way, the URLs within the Haddock documentation are
formatted improperly (because Haddock interprets the forward slashes
as italic markers).  You should place the URLs within angle brackets
like http://github.com/foo/bar and Haddock will turn them into real
clickable links.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal install fails due to recent HUnit

2012-08-27 Thread Brent Yorgey
On Mon, Aug 27, 2012 at 10:52:59AM -0700, Bryan O'Sullivan wrote:
 On Mon, Aug 27, 2012 at 9:57 AM, Erik Hesselink hessel...@gmail.com wrote:
 
  I'm seeing this again, on abstract-deque-0.1.6. Ross, can you fix it again?
 
 
 Hang on a second.
 
 The reason you're seeing build breakage is that the .cabal files of the
 broken packages were edited in-place without communicating with any of the
 package authors.
 
 I understand that the collective intentions around this were good, but by
 fixing things without telling anyone, package maintainers have no way to
 know that anything has happened. Now we are seeing the problem begin to
 recur as people issue new releases that don't incorporate those changes.

For the record, abstract-deque was neither one of the packages fixed
previously, nor does its .cabal file even contain a test section at
all, much less one with a conditional.  So if cabal-install-0.10 is
failing to read it, it is because of some different problem.  But I
agree with Bryan in principle that we need a more principled approach.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] explicit annotations on kind polymorphism for data types

2012-08-24 Thread Brent Yorgey
Correct.  I just meant that you can use a lowercase x or a
lowercase chi (χ).  Any lowercase characters (as defined by Unicode)
can be used as identifiers.

-Brent

On Thu, Aug 23, 2012 at 11:09:41AM -0400, dude wrote:
 Not in 7.4.2, correct?
 
 --
 dude
 
 On 08/22/2012 09:58 AM, Brent Yorgey wrote:
 I believe in the paper it is actually a lowercase Greek chi (χ), which
 should work too. ;)
 
 -Brent
 
 On Wed, Aug 22, 2012 at 08:15:48AM +0200, José Pedro Magalhães wrote:
 Nope, but it should work on 7.6 (also on the release candidate).
 The 'X' should be lowercase, though, like type variables.
 
 
 Cheers,
 Pedro
 
 On Wed, Aug 22, 2012 at 12:01 AM, dude d...@methodeutic.com wrote:
 
 Hello All:
 
 I'm working through Giving Haskell a Promotion.
 
 Section 2.4 presents an explicitly annotated data type declaration similar
 to the following:
 
 data EqRefl (a::X)(b::X) where
Refl :: forall X. forall (a::X). EqRefl a a
 
 Has this been implemented in GHC 7.4.2?
 
 7.8.3 in the GHC User Guide leads me to believe it has not.
 
 --
 dude
 
 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 
 
 
 -- 
 --
 dude
 
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] model theory for type classes

2012-08-23 Thread Brent Yorgey
On Thu, Aug 23, 2012 at 01:25:39PM +0100, Patrick Browne wrote:
 
If there is no model expansion could it be because of the constructor
discipline, which only allows variables, and constructors in the LHS
argument patterns.

Indeed, a variable name as a pattern on the LHS of a function
definition has nothing to do with any names which might be in scope.
It is simply a pattern which matches anything.  I am not sure what (if
anything) this says about model expansions.

constant::Int
constant = (1::Int)
fun1::Int - Int
fun1 (constant::Int) = 8

fun1 returns 8 for all inputs.  The fact that fun1's definition uses
the name 'constant' which happens to have the same name as something
in scope is irrelevant.  For example, this is precisely the same as the above:

constant :: Int
constant = 1
fun1 :: Int - Int
fun1 foo = 8

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] explicit annotations on kind polymorphism for data types

2012-08-22 Thread Brent Yorgey
I believe in the paper it is actually a lowercase Greek chi (χ), which
should work too. ;)

-Brent

On Wed, Aug 22, 2012 at 08:15:48AM +0200, José Pedro Magalhães wrote:
 Nope, but it should work on 7.6 (also on the release candidate).
 The 'X' should be lowercase, though, like type variables.
 
 
 Cheers,
 Pedro
 
 On Wed, Aug 22, 2012 at 12:01 AM, dude d...@methodeutic.com wrote:
 
  Hello All:
 
  I'm working through Giving Haskell a Promotion.
 
  Section 2.4 presents an explicitly annotated data type declaration similar
  to the following:
 
  data EqRefl (a::X)(b::X) where
Refl :: forall X. forall (a::X). EqRefl a a
 
  Has this been implemented in GHC 7.4.2?
 
  7.8.3 in the GHC User Guide leads me to believe it has not.
 
  --
  dude
 
  __**_
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe
 

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-20 Thread Brent Yorgey
On Thu, Aug 16, 2012 at 06:07:06PM -0400, Joey Adams wrote:
 On Wed, Aug 15, 2012 at 3:38 PM, Bryan O'Sullivan b...@serpentine.com wrote:
  I propose that the sense of the recommendation around upper bounds in the
  PVP be reversed: upper bounds should be specified only when there is a known
  problem with a new version of a depended-upon package.
 
 I, too, agree.  Here is my assortment of thoughts on the matter.
 
 Here's some bad news: with cabal 1.14 (released with Haskell Platform
 2012.2), cabal init defaults to bounds like these:
 
   build-depends:   base ==4.5.*, bytestring ==0.9.*,
   http-types ==0.6.*

I'm not sure why you think this is bad news.  I designed this to
conform exactly to the current PVP.  If the PVP is changed then I will
update cabal init to match.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Platform Versioning Policy: upper bounds are not our friends

2012-08-16 Thread Brent Yorgey
On Thu, Aug 16, 2012 at 05:30:07PM +0300, Yitzchak Gale wrote:
 
 For actively maintained packages, I think the
 problem is that package maintainers don't find
 out promptly that an upper bound needs to be
 bumped. One way to solve that would be a
 simple bot that notifies the package maintainer
 as soon as an upper bound becomes out-of-date.

This already exists:

  http://packdeps.haskellers.com/
 
-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] hGetContents Illegal byte sequence / ghc-pkg

2012-08-11 Thread Brent Yorgey
On Sat, Aug 11, 2012 at 12:13:45PM +0100, Benjamin Edwards wrote:
 Hello café,
 
 I have a program that is crashing, and I have no idea why:
 
 module Main
   where
 
 import System.Process (readProcessWithExitCode)
 
 
 main :: IO ()
 main = do _ - readProcessWithExitCode ghc-pkg [describe, hoopl] 
   putStrLn Should never get here
 
 this is using the process package from hackage. The program crashes with
 
 minimal-test: fd:5: hGetContents: invalid argument (invalid byte sequence)
 minimal-test: thread blocked indefinitely in an MVar operation
 
 inspecting the source of readProcessWithExitCode yields an obvious
 explanation to the MVar problem, but I don't understand why hGetContents is
 so offended.

The 'invalid argument' error from hGetContents indicates that a wrong
encoding is being assumed.  I don't know enough about how
putStr/hGetContents decide on an encoding, but in any case it works
for me (that is, it prints Should never get here).  The likely
sticking point is that one of the authors of hoopl, João Dias, has a
name which contains U+00E3: LATIN SMALL LETTER A WITH TILDE.

Try doing  

  ghc-pkg describe hoopl  hoopl.txt
  file hoopl.txt

to get an indication of what encoding is being used, or manually take
a look at the bytes being generated using

  ghc-pkg describe hoopl | hexdump -C

I don't know what the solution is but at least this should give some
additional information.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] ALife category

2012-08-02 Thread Brent Yorgey
On Thu, Aug 02, 2012 at 01:50:50PM +, Amy de Buitléir wrote:
 I'm developing a framework for artificial life experiments that I would like 
 to
 make available on Hackage eventually. I've read all the guidance and 
 proposals I
 could find for where to place packages in the hierarchy:
 
 http://www.haskell.org/haskellwiki/Hierarchical_module_names
 http://www.cs.york.ac.uk/fp/libraries/layout.html
 http://www.cs.york.ac.uk/fp/libraries/layoutSM.html
 
 I've also examined the current hierarchy of modules:
 
 http://hackage.haskell.org/packages/archive/pkg-list.html
 
 The current hierarchy has a top-level AI category, so it would seem logical to
 me to add a top-level ALife category and put my package under that. But 
 perhaps
 it would be best not to start a new top-level category? I could put my package
 under AI, because my framework does support the use of AI, and wouldn't look 
 too
 out of place with the other packages there.

(Moving the discussion to haskell-cafe; haskell@haskell is generally
for announcements and such.)

It seems to me that you might be confusing two separate things.
Cabal packages may list one or more categories, which are used to
group packages on the main list of packages:
http://hackage.haskell.org/package/ .  In general, I would say that
you should avoid creating a new top-level category.

Hierarchical module names are something different.  The 'Category'
specified in the .cabal file does NOT have to be the same as the first
component of your module names (though for many packages it is).  For
example, it would be perfectly fine to specify 'AI' as the category,
and then have module names like

  ALife.Foo

and so on.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to select random elements of a Data.Set?

2012-07-20 Thread Brent Yorgey
On Fri, Jul 20, 2012 at 01:24:57PM +, jwaldmann wrote:
 Dear all,
 
 how would I quickly select an element of a Set (as in Data.Set)
 uniformly at random? 
 
 Via the API, this can only be done in linear time? (via toList)
 If I could access the tree structure, 
 then of course it could be logarithmic.

If you had access to the Set constructors, this would be very easy, as
each node caches a size.  Unfortunately there does not appear to be
any way to do this in sub-linear time via the exposed API, because
there is no way to directly access the subtrees.

I wonder about the wisdom of exporting a function like

  -- | Partition a set into two approximately equal-sized subsets.
  --   If @divide s == (s1,s2)@, then 
  -- * @s1 `intersect` s2 == empty@
  -- * @s1 `union` s2 == s@
  -- * The sizes of @s1@ and @s2@ differ by at most a constant factor
  --   (currently, 3).
  divide :: Set a - (Set a, Set a)

which would give you enough to implement what you want, without
breaking the Set abstraction.  (However, even though technically it
doesn't break any abstraction, it still smells somewhat
implementation-dependent...)

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to add constraint to .cabal?

2012-07-19 Thread Brent Yorgey
On Thu, Jul 19, 2012 at 09:37:52AM +0800, Magicloud Magiclouds wrote:
 Hi,
   Say I have a package that only appends
 --constraint=template-haskell==2.7.0.0
 --constraint=warp-tls==1.2.1 could I install it. Now I want to
 release the package, then how could I have these constraint into the
 .cabal so the user would not get troubled?

Using the build-depends field.  See
http://www.haskell.org/cabal/users-guide/developing-packages.html#build-information

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Adding to the haskell wiki

2012-07-16 Thread Brent Yorgey
On Mon, Jul 16, 2012 at 02:00:46PM +0200, Nathan Hüsken wrote:
 Hey,
 
 I have been a passive member of the haskell community for quite some
 time now. I have benefit from the community a lot through the mailing
 list, the haskell webpage and other channels. Thanks for all that!
 
 Now I am trying to give a little bit back, and I started a blog about
 writing javascript games in haskell using UHC and haste.
 I am not an expert in haskell nor javascript, but I am collecting
 information from various sources and put it together in the blog so that
 others with a similar goal my have a smoother start.
 
 Writing a blog is one thing, but of course I also want people who are
 interested in the topic to find it.
 
 Never being an active member of the community, I wonder if I should do.
 I guess I should add it to the haskellwiki. But I am unsure where.
 It certainly falls in the games category, but the page only lists game
 projects.
 
 The blog can be found here: http://jshaskell.blogspot.de/

If you want people to find your blog, a better idea is to have it
added to the Planet Haskell blog aggregator. [1] Then write blog posts
which are interesting enough that people will post them to the Haskell
reddit.  I doubt putting a link to your blog on the Haskell wiki will
make much difference, though you are certainly welcome to of course.

[1] http://planet.haskell.org/

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to build a GHC backend?

2012-07-09 Thread Brent Yorgey
On Sun, Jul 08, 2012 at 09:21:08AM -0600, Jonathan Geddes wrote:
 I agree that the Raison d'être for a .NET or JVM backend is interop.
 Perhaps that's not worth the effort of an entirely new backend. JavaScript
 is a different beast, however.  I said before:
 
 From my point of view, languages that cannot run on one of the 3
  aforementioned platforms will become irrelevant. (with the exception of
 C,
  of course).
 
 I'll take that one step further and say that for web applications it is
 becoming increasingly difficult to justify using a language that WILL NOT
 run both client and server. JavaScript (with NodeJS), Clojure (with
 ClojureScript), and Dart are just a few examples.
 
 I really believe that with a solid JavaScript backend, Haskell would be an
 ideal web application language. Am I alone in that belief? What can I do to
 get the ball rolling on that?

I should point out that the ball already IS rolling -- ranging from
EDSLs that compile to JavaScript [1,2] to macro systems [3] to more
serious full-featured efforts [4,5].  There's even a wiki page listing
all these and more [6].  The yesod developers share your view that
Haskell would benefit from some sort of JavaScript backend; see [7] as
well as the ensuing discussion on Reddit [8]. See also Elm [9], which
compiles to HTML+CSS+JavaScript and has some Haskell integration [10].

Rather than trying to start yet another effort, what about
contributing to one of these ongoing ones?

-Brent

[1] http://www.ittc.ku.edu/csdlblog/?p=88
[2] http://www.ittc.ku.edu/csdl/fpg/node/125
[3] http://www.haskell.org/haskellwiki/JMacro
[4] http://uu-computerscience.github.com/uhc-js/
[5] https://github.com/ghcjs/ghcjs
[6] http://www.haskell.org/haskellwiki/The_JavaScript_Problem
[7] http://www.yesodweb.com/blog/2012/04/client-side
[8] 
http://www.reddit.com/r/haskell/comments/sm72n/client_side_yesod_an_frpinspired_approach/
[9] http://elm-lang.org/
[10] 
http://www.reddit.com/r/haskell/comments/uugne/announcing_elm_02_haskell_integration_yesod/

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] combining predicates, noob question

2012-07-09 Thread Brent Yorgey
On Sat, Jul 07, 2012 at 09:42:01PM -0300, Sebastián Krynski wrote:
 Ok , thanks for the answers, I understand now what  liftM2 does.
  In this case would it be silly to  use  combinerPred (and maybe a newType
  Predicate a = a - Bool) for the sake of readability or shoud I stick with
 a - Bool  and  liftM2?

No, not silly.  Use whatever you find most readable.

-Brent




___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] combining predicates, noob question

2012-07-06 Thread Brent Yorgey
On Fri, Jul 06, 2012 at 03:17:54PM -0300, Felipe Almeida Lessa wrote:
 On Fri, Jul 6, 2012 at 2:11 PM, Sebastián Krynski skryn...@gmail.com wrote:
  As I was using predicates (a - bool) , it appeared the need for combining
  them with a boolean operator (bool - bool - bool)  in order to get a new
  predicate
  combining the previous two. So I wrote my function combinerPred (see code
  below). While I think this is JUST ok, i'm feeling a monad in the air.
   So.. where is the monad?
 
  combinerPred ::  (a - Bool)  - (a - Bool) - (Bool - Bool - Bool) -
  (a - Bool)
  combinerPred pred1 pred2 op = \x - op (pred1 x) (pred2 x)
 
 That's the `(-) a` monad:
 
   import Control.Applicative
 
   combinerPred ::  (a - Bool)  - (a - Bool) - (Bool - Bool -
 Bool) - (a - Bool)
   combinerPred pred1 pred2 op = op $ pred1 * pred2

By the way, I find it more natural to make 'op' the first argument,
because it is more useful to partially apply combinerPred to an
operation that it is to some predicates.  Also, in that case
combinerPred is simply liftA2:

  import Control.Applicative

  combinerPred :: (Bool - Bool - Bool) - (a - Bool) - (a - Bool) - (a - 
Bool)
  combinerPred = liftA2

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] class instances for kinds with finite ty constrs, does this make sense?

2012-06-08 Thread Brent Yorgey
On Thu, Jun 07, 2012 at 07:32:45PM +0100, ex falso wrote:
 
 we always have to put the class restriction (TupleLength l) there,
 even though all possible type constructors of [*] have a TupleLength
 instance defined!

Yes, and this is a feature, for at least two reasons.

First: to the extent that Haskell's type system corresponds to a
logic, it corresponds to a constructive one.  Types/propositions are
inhabited/proved by explicit terms/evidence. But this request (and
[1]) essentially boil down to a desire for double negation
elimination: if there *can't* *not* be a certain instance, then the
compiler should infer that there *is* one.  This seems weird to me
(though perhaps I've just drunk too much of the constructivism
kool-aid).

Second, on a more practical level, the ability to omit class
constraints like this would make reasoning about types much more
non-local and difficult, since a type like

  foo :: Bar a - Baz

may or may not implicitly expand to something like

  foo :: SomeClass a = Bar a - Baz

(which could have important implications for things like inlining,
sharing, etc. -- cf the monomorphism restriction), but figuring out
whether it does or not requires knowing (a) the definition of Bar and
all the instances that are in scope, and (b) whether or not
SomeClass's methods ever get called from foo (or anything it calls,
recursively).  I'd much rather explicitly write the SomeClass
constraint if I want it, and be guaranteed that it won't be added if I
don't.

In summary, these constraints may be superfluous in a strictly
logical sense, but (a) not in the kind of logic that Haskell uses, and
(b) the pain and suffering caused by removing them would far outweigh
the tiny bit of typing that would be saved.

-Brent

[1] 
http://haskell.1045720.n5.nabble.com/Data-Kinds-and-superfluous-in-my-opinion-constraints-contexts-td5689436.html

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Restricted Monad question

2012-06-04 Thread Brent Yorgey
On Mon, Jun 04, 2012 at 11:35:20AM +0200, Ismael Figueroa Palet wrote:
 Hi, I was wondering about defining a restricted monad, and found out this
 blog post: http://blog.omega-prime.co.uk/?p=127
 
 In GHC 7.4.1 still the recommended way is using the rmonad package,
 right?

You can do it however you want, I don't think there's really a
recommended way.  But using the rmonad package is certainly more
convenient.

 I guess the tricks with ConstraintKinds explained in the blog are used for
 internal implementation of RMonad?

No, the rmonad package has been around since long before the
ConstraintKinds extension was even conceived.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Installation of the New Haskell Platform

2012-06-04 Thread Brent Yorgey
On Mon, Jun 04, 2012 at 11:04:36AM -0400, Victor Miller wrote:
 Before I install it (on on Mac OS X Lion) is there anything, manually, that
 I need to do in order to keep all of the cabal packages that I've
 installed, or are the reinstalled automatically?

Neither.  If you install a new version of GHC, you must reinstall any
cabal packages you want, because they must be recompiled with the new
GHC.

Note that cabal-install does have a special command

  cabal install world

which (IIUC) is supposed to help automate this process, although I
can't vouch for it since I have never tried it.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Formalisation for types of monads

2012-05-24 Thread Brent Yorgey
On Wed, May 23, 2012 at 09:24:06AM +0200, Ertugrul Söylemez wrote:
 Yves Parès yves.pa...@gmail.com wrote:
 
   Note about []:  Don't even mention foldl.  The folding
   combinator for lists is foldr, period.
 
  Yes, I do agree. I came to this when I realized foldr gave the church
  encoding of a list.
 
 Not only that.  The foldr combinator has an identity fold and implements
 actual structural recursion.

That's pretty much what a Church encoding is.  Though I agree it's
probably best not to mention the phrase Church encoding to beginning
students.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] cool tools

2012-05-21 Thread Brent Yorgey
On Thu, May 17, 2012 at 03:05:22PM +0100, Chris Dornan wrote:
 I have been playing around with the latest cabal-install (0.14.0) and it is
 working really nicely. Having unpacked a cabal bundle you can now type
 'cabal install' inside the root and it will work everything out as if you
 had asked to install directly from the repo -- very nice.

I should point out that cabal-install has actually had this feature
for a long time.  Which of course in no way detracts from your point
(quite the opposite, in fact).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Learn you

2012-05-02 Thread Brent Yorgey
I am curious how the title was translated.  Of course, the English
title Learn You a Haskell for Great Good uses intentionally
ungrammatical/unidiomatic English for humorous effect.  Is the
Japanese title also ungrammatical/unidiomatic Japanese?  Or do
Japanese speakers not find that humorous?

-Brent

On Wed, May 02, 2012 at 03:59:18PM +0900, Kazu Yamamoto wrote:
 Hello cafe,
 
 Translating Learn You a Haskell for Great Good into Japanese was
 finished and will be published on 22 May. I guess it's worth watching
 its cover page:
 
   
 http://www.amazon.co.jp/%E3%81%99%E3%81%94%E3%81%84Haskell%E3%81%9F%E3%81%AE%E3%81%97%E3%81%8F%E5%AD%A6%E3%81%BC%E3%81%86-Miran-Lipova%C4%8Da/dp/4274068854
 
 There are two translators: Tanaka is the author of peggy and Muranushi is
 the author of Monadius.
 
 Regards,
 
 --Kazu
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Multi-site haddock documentation with proper links?

2012-04-25 Thread Brent Yorgey
It is possible.  I have done it for 
  
  http://projects.haskell.org/diagrams/doc/index.html

But it is not fun, and it took me several days of work (spread over
two weeks) to figure out the proper magic incantations to get
everything to work properly.  I really ought to write up a blog post
with instructions; I'll try to do that soon.

-Brent

On Tue, Apr 24, 2012 at 08:34:53PM -0400, Ryan Newton wrote:
 Hello cafe,
 
 For various reasons, some packages don't build documentation on hackage:
 
http://hackage.haskell.org/package/accelerate
 
 Therefore I want to locally install documentation for a set of packages
 like this and host them on a separate website.  I want all of these ~ten
 packages' haddock documentation to be properly interlinked with eachother,
 but also to link to Hackage for types and classes defined in other modules.
 
 Is this possible?  Hackage haddocks are all interlinked, but that is simply
 because hackage is one giant local install, right?
 
 If it's not possible (and it seems not) do any haddock devs have pointers
 on how to implement this?
 
 Thanks,
   -Ryan
 
 P.S.  Someone recommended to me the following simple hack -- just use sed
 to rewrite the links after haddock generates the html.  I think I'll do
 that for the time being unless someone has a better suggestion.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] is the evaluation order deterministic when using applicative with IO

2012-03-16 Thread Brent Yorgey
On Fri, Mar 16, 2012 at 12:30:13PM +0100, Twan van Laarhoven wrote:
 
 If you want to avoid the side effects of boolTest2 when boolTest1
 returns true, you will need to implement a monadic or, something like
 
 orM ma mb = do
 a - ma
 if a then return True else mb

Note also that it is *not possible* to have this short-circuiting
behavior using only Applicative.  The structure of an Applicative
computation is always fixed up front, and cannot depend on
intermediate values.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Open-source projects for beginning Haskell students?

2012-03-16 Thread Brent Yorgey
Hi everyone,

I am currently teaching a half-credit introductory Haskell class for
undergraduates.  This is the second time I've taught it.  The last
time, for their final project I gave them the option of contributing
to an open-source project; a couple groups took me up on it and I
think it ended up being a modest success.

So I'd like to do it again this time around, and am looking for
particular projects I can suggest to them.  Do you have an open-source
project with a few well-specified tasks that a relative beginner (see
below) could reasonably make a contribution towards in the space of
about four weeks? I'm aware that most tasks don't fit that profile,
but even complex projects usually have a few simple-ish tasks that
haven't yet been done just because no one has gotten around to it
yet.

If you have any such projects, I'd love to hear about it!  

Here are a few more details:

* The students will be working on the projects from approximately the
  end of this month through the end of April.

* By relative beginner I mean someone familiar with the material
  listed here: http://www.cis.upenn.edu/~cis194/lectures.html and just
  trying to come to terms with Applicative and Monad.  They definitely
  do not know much if anything about optimization/profiling, GADTs,
  the mtl, or Haskell-programming-in-the-large.  (Although part of the
  point of the project is to teach them a bit about
  programming-in-the-(medium/large)).

* What I would hope from you is a willingness to exchange email and/or
  chat with the student(s) over the course of the project, to give
  them a bit of guidance/mentoring.  I am certainly willing to help on
  that front, but of course I probably don't know much about your
  particular project.

thanks!
-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: diagrams 0.5

2012-03-09 Thread Brent Yorgey
I am pleased to announce the release of version 0.5 of diagrams [1], a
full-featured framework and embedded domain-specific language for
declarative drawing. Check out the gallery [2] for examples of what it
can do!

[1] http://projects.haskell.org/diagrams
[2] http://projects.haskell.org/diagrams/gallery.html


Highlights of this release include:

-   A new diagrams-contrib [3] package of user-contributed modules,
which so far contains code for tree drawing, Apollonian gaskets,
planar tilings, wrapped layout, and turtle graphics.

-   Experimental support for animation, built on top of the new active
[4] library.

-   Numerous small additions and improvements, including more general
rounded rectangle shapes and better text support.

-   Much better performance in some common situations, such as laying
out a very long list of diagrams using 'cat' and related
combinators.

-   Added support for GHC 7.4.

See the release notes [5] for complete details, and the diagrams wiki
[6] for help migrating code from 0.4 to 0.5 (changes should be minimal).

[3] http://hackage.haskell.org/package/diagrams%2Dcontrib
[4] http://hackage.haskell.org/package/active
[5] http://projects.haskell.org/diagrams/releases.html
[6] http://www.haskell.org/haskellwiki/Diagrams/Migrate0.5


Try it out
--

For the truly impatient:

cabal install gtk2hs-buildtools
cabal install diagrams

Diagrams is supported under GHC 6.12, 7.0, 7.2, and 7.4. However,
getting cairo to build can be tricky on some platforms; see the
diagrams wiki [8] for more information and workarounds regarding
specific platforms. (A new native SVG backend is in the works,
targeted for the 0.6 release.)

To get started with diagrams, read the quick tutorial [9], which will
introduce you to the fundamentals of the framework.

For those who are even less impatient but want to really dig in and use
the power features, read the user manual [10].

[7]  http://projects.haskell.org/gtk2hs/development/#development
[8]  http://www.haskell.org/haskellwiki/Diagrams
[9]  http://projects.haskell.org/diagrams/tutorial/DiagramsTutorial.html
[10] http://projects.haskell.org/diagrams/manual/diagrams-manual.html


Get involved


Subscribe to the project mailing list [11], and/or come hang out in
the #diagrams IRC channel on freenode.org for help and
discussion. Make some diagrams. Fix some bugs [12]. Submit your cool
examples for inclusion in the gallery or your cool code for inclusion
in the diagrams-contrib package!

[11] http://groups.google.com/group/diagrams-discuss
[12] http://code.google.com/p/diagrams/issues/list


Happy diagramming!

Brought to you by the diagrams team:

-   Peter Hall
-   Ian Ross
-   Michael Sloan
-   Ryan Yates
-   Brent Yorgey

with contributions from:

-   Sam Griffin
-   Claude Heiland-Allen
-   John Lato
-   Vilhelm Sjoberg
-   Luite Stegeman
-   Kanchalai Suveepattananont
-   Scott Walck


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2012-03-08 Thread Brent Yorgey
On Thu, Mar 08, 2012 at 07:53:48PM +0100, Christopher Done wrote:
 On 8 March 2012 18:32, Anthony Cowley acow...@seas.upenn.edu wrote:
  Perhaps Data.Key meets your needs?
 
  http://hackage.haskell.org/packages/archive/keys/2.1.2/doc/html/Data-Key.html
 
 Ah, perhaps indeed. Thanks!
 
 On 8 March 2012 19:12, Francesco Mazzoli f...@mazzo.li wrote:
  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.
 
 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.

Monads have nothing to do with failure.  Instead of Monad you would
want to use something like MonadZero or MonadError.  However, these
are also suboptimal because in monads which carry extra information
about the failure (i.e. anything other than [] or Maybe), the lookup
function now has to make up an error message, when it almost certainly
it doesn't know enough to give a good one.  This is why the use of
Maybe is encouraged: Maybe is the *initial* instance of MonadZero, so
you can map from it to failure in whatever monad you happen to be
using.  Instead of being an annoyance this is encouraged style,
because in doing the conversion *you* get to pick a meaningful error
message.  For example

  fromMaybe (throwError WidgetNotFound) (lookup foo blah)

or

  fromMaybe (Left Missing wurble specification: flozz) (lookup foo blah)

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] FreeSect -- generalised sections syntax extension

2012-03-04 Thread Brent Yorgey
On Sat, Mar 03, 2012 at 10:37:10PM -0500, Ras Far wrote:
 letters correspond to grammar, words, or meaning.  So we've got love,
 too (Aramaic word “Abba” = love of God or so...)

Not quite, it's a familiar/intimate form of father, cf English
papa, dada or daddy.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Does somebody know about these functions?

2012-02-28 Thread Brent Yorgey
On Tue, Feb 28, 2012 at 06:06:25PM +0100, Johan Holmquist wrote:
 
 inter :: (a - a - b) - [a] - [b]
 inter f [] = []
 inter f l  = map (uncurry f) $ zip l (tail l)

I've never seen this function defined anywhere, but it looks nice.

 withPair :: (a' - b' - c) - (a - a') - (b - b') - (a,b) - c
 withPair f fa fb (a,b) = fa a `f` fb b

Note that

  withPair f g h === uncurry f . (g *** h)

although using withPair is probably nicer (it certainly involves fewer
parentheses).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Using multiplate to get free variables from a syntax tree

2012-02-24 Thread Brent Yorgey
On Thu, Feb 23, 2012 at 01:18:22PM -0800, Matt Brown wrote:
 Hi all,
 
 I'm reading the haskellwiki article on multiplate. Is it possible to
 modify the getVariablesPlate example to return the free variables?
 One idea I had is to store an environment in a reader monad, and use
 local to update the environment at a let expression.  Couldn't figure
 it out, though.  Any ideas?

Hi Matt,

I am not very familiar with Multiplate, but from what I can see it
doesn't seem like this will work.  The code for traversing Let looks
like

  Let $ decl child d * expr child e

The call to 'decl child d' can certainly have some sort of
side-effects which can influence the processing of e -- but
intuitively it seems to me there is no way to *localize* the effects
only to e; it will also affect everything processed afterwards.

If you really do want to compute free variables (not just test the
limits of Multiplate), you may be interested in taking a look at
Unbound:

  http://hackage.haskell.org/package/unbound

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to print out intermediate results in a recursive function?

2012-02-04 Thread Brent Yorgey
On Sat, Feb 04, 2012 at 12:23:07PM -0600, Qi Qi wrote:
 Hello,
 
 I have a question;how can I print out the intermediate number lists in a
 mergesort recursive function like the following one.
 
 merge [] ys = ys
 merge xs [] = xs
 merge (x:xs) (y:ys) = if x = y
   then x : merge xs (y:ys)
   else y : merge (x:xs) ys
 
 mergesort [] = []
 mergesort [x] = [x]
 mergesort xs = let (as, bs) = splitAt (length xs `quot` 2) xs
in merge (mergesort as) (mergesort bs)
 
 main = do
print $ mergesort [5,4,3,2,1]
   
 
 In the main function, it only prints out the final number list. But I'd
 like to print out the number lists in every recursive level. How can I
 do that? Thanks.

For visualizing intermediate steps for the purpose of
debugging, there is also the very nice hood package:

  http://hackage.haskell.org/package/hood

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] how to print out intermediate results in a recursive function?

2012-02-04 Thread Brent Yorgey
On Sun, Feb 05, 2012 at 01:17:31AM -0600, Qi Qi wrote:
 Brilliant! That's what I was looking for. Thanks for all the replies.
 
 Sometimes, I suspect that Haskell not only makes easier of the hard things for
 imperative programming languages but also makes harder of some easy
 things. 

This is true.  But usually these are things that you don't *want* to
be easy, like shooting yourself in the kidney. (But these features are
often described in ways that make them sound great, like flexible
usage of bullet-placement tools.)  Inserting arbitrary print
statements into the middle of some code is difficult for a reason.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: combinatorics

2012-02-03 Thread Brent Yorgey
On Fri, Feb 03, 2012 at 01:06:16AM -0500, wren ng thornton wrote:
 On 2/2/12 6:46 PM, Carter Schonwald wrote:
 On Thu, Feb 2, 2012 at 4:06 PM, Ivan Lazar Miljenovic wrote:
 On 3 February 2012 07:11, Brent Yorgey wrote:
 On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote:
 
 [2] HaskellForMaths, gamma, statistics, erf, math-functions,
 combinat,...
 
 To this list I'd like to add 'species' and also the specialized
 'multiset-comb' packages.  The former doesn't build under recent GHCs
 but I plan to fix that (and continue extending the library) soon.
 
 Would people be interested in creating a mailing list for those
 interested in combinatorics+Haskell?
 
 I would.
 
 ditto
 
 I don't know how involved I'd be, but I'd join. It's just a side
 interest for me (more a curiosity than a hobby at this point), though
 I would definitely like to see things better organized and integrated
 since it seems like there are a bunch of folks with passing interest
 in the area, and it's someplace that Haskell could really shine.

OK, I've emailed mail...@haskell.org requesting the creation of a
combinator...@haskell.org mailing list (if anyone knows of a better
way to go about this let me know).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: combinatorics

2012-02-02 Thread Brent Yorgey
On Wed, Feb 01, 2012 at 01:53:03AM -0500, wren ng thornton wrote:
 
 [2] HaskellForMaths, gamma, statistics, erf, math-functions,
 combinat,...

To this list I'd like to add 'species' and also the specialized
'multiset-comb' packages.  The former doesn't build under recent GHCs
but I plan to fix that (and continue extending the library) soon.

Would people be interested in creating a mailing list for those
interested in combinatorics+Haskell?

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Natural Transformations and fmap

2012-01-23 Thread Brent Yorgey
On Mon, Jan 23, 2012 at 09:06:52PM -0800, Ryan Ingram wrote:
 On Mon, Jan 23, 2012 at 8:05 PM, Daniel Fischer 
 daniel.is.fisc...@googlemail.com wrote:
 
  On Tuesday 24 January 2012, 04:39:03, Ryan Ingram wrote:
   At the end of that paste, I prove the three Haskell monad laws from the
   functor laws and monoid-ish versions of the monad laws, but my proofs
   all rely on a property of natural transformations that I'm not sure how
   to prove; given
  
   type m :- n = (forall x. m x - n x)
   class Functor f where fmap :: forall a b. (a - b) - f a - f b
   -- Functor identity law: fmap id = id
   -- Functor composition law fmap (f . g) = fmap f . fmap g
  
   Given Functors m and n, natural transformation f :: m :- n, and g :: a
   - b, how can I prove (f . fmap_m g) = (fmap_n g . f)?
 
  Unless I'm utterly confused, that's (part of) the definition of a natural
  transformation (for non-category-theorists).
 
 
 Alright, let's pretend I know nothing about natural transformations and
 just have the type declaration
 
 type m :- n = (forall x. m x - n x)
 
 And I have
 f :: M :- N
 g :: A - B
 instance Functor M -- with proofs of functor laws
 instance Functor N -- with proofs of functor laws
 
 How can I prove
   fmap g. f :: M A - N B
   =
   f . fmap g :: M A - N B
 
 I assume I need to make some sort of appeal to the parametricity of
 M :- N.

This is in fact precisely the free theorem you get from the
parametricity of f.  Parametricity means that f must act uniformly
for all x -- which is an intuitive way of saying that f really is a
natural transformation.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Simple type-class experiment turns out not so simple...

2012-01-08 Thread Brent Yorgey
On Fri, Jan 06, 2012 at 10:51:58AM +, Steve Horne wrote:
 
 If I specify both extensions (-XMultiParamTypeClasses and
 -XFlexibleInstances) it seems to work, but needing two language
 extensions is a pretty strong hint that I'm doing it the wrong way.

Not necessarily.  These two extensions in particular (and especially
the second) are quite uncontroversial.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Solved but strange error in type inference

2012-01-03 Thread Brent Yorgey
The other much simpler solution no one has mentioned yet is to just
pull 'subsome' out as its own top-level declaration.  Having such a
big function nested locally within a 'let' is ugly anyway, and it
makes it harder to test and debug than necessary.

-Brent

On Tue, Jan 03, 2012 at 05:44:01PM +0100, Yves Parès wrote:
 Remove subsome type signature. You are redeclaring type variables which
 obviously cannot match those of legSome.
 This cannot work without scoped type variables (and ad-hoc foralls to bring
 them to scope, of course).
 
 2012/1/3 Yucheng Zhang yczhan...@gmail.com
 
  As I investigated the code more carefully, I found that the type
  unification
  failure may not be related to the suspected class constraint on data
  constructor.
 
  I have made minor changes to the original code to remove the Ord
  constraint,
  including introducing a FakedMap with no requirement on Ord. The type
  unification
  failure continues:
 
  Couldn't match type `nt1' with `nt'
`nt1' is a rigid type variable bound by
  the type signature for
subsome :: [RRule nt1 t1 s1] - Either String ([t1], s1)
  at xx.hs:34:19
`nt' is a rigid type variable bound by
 the type signature for
   legSome :: LegGram nt t s - nt - Either String ([t], s)
 at xx.hs:29:1
  Expected type: [Symbols nt1 t1]
Actual type: [Symbols nt t]
  In the first argument of `makeWord', namely `r'
  In the expression: makeWord r
 
  The complete changed code follows:
 
 
  data Symbols nt t = NT nt -- ^ non terminal
   | T t  -- ^ terminal
   deriving (Eq, Ord)
 
  type Sem s = [s]-s
 
  data Rule nt t s = Rule { refined :: nt
, expression :: [Symbols nt t]
, emit :: Sem s
}
 
  type RRule nt t s = ([Symbols nt t], Sem s)
 
 
 
  data FakedMap a b = FakedMap
 
  delete :: k - FakedMap k a - FakedMap k a
  delete a b = b
 
  lookup :: k - FakedMap k a - Maybe a
  lookup a b = Nothing
 
 
 
  data LegGram nt t s = LegGram (FakedMap nt [RRule nt t s])
 
  legSome :: LegGram nt t s - nt - Either String ([t], s)
  legSome (LegGram g) ntV =
   case Main.lookup ntV g of
  Nothing - Left No word accepted!
  Just l - let sg = legSome (LegGram (Main.delete ntV g))
subsome :: [RRule nt t s] - Either String ([t], s)
   subsome [] = Left No word accepted!
   subsome ((r,sem):l) =
 let makeWord [] = Right ([],[])
 makeWord ((NT nnt):ll) =
   do (m, ss) - sg nnt
  (mm, sss) - makeWord ll
  return (m++mm, ss:sss)
 makeWord ((T tt):ll) =
   do (mm, sss) - makeWord ll
  return (tt:mm, sss)
  in
case makeWord r of
  Right (ll, mm) - Right (ll, sem mm)
  Left err - subsome l
   in subsome l
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reifying case expressions [was: Re: On stream processing, and a new release of timeplot coming]

2011-12-28 Thread Brent Yorgey
On Mon, Dec 26, 2011 at 12:32:13PM +0400, Eugene Kirpichov wrote:
 2011/12/26 Gábor Lehel illiss...@gmail.com
 
  On Sun, Dec 25, 2011 at 9:19 PM, Eugene Kirpichov ekirpic...@gmail.com
  wrote:
   Hello Heinrich,
  
   Thanks, that's sure some food for thought!
  
   A few notes:
   * This is indeed analogous to Iteratees. I tried doing the same with
   Iteratees but failed, so I decided to put together something simple of my
   own.
   * The Applicative structure over this stuff is very nice. I was thinking,
   what structure to put on - and Applicative seems the perfect fit. It's
  also
   possible to implement Arrows - but I once tried and failed; however, I
  was
   trying that for a more complex stream transformer datatype (a hybrid of
   Iteratee and Enumerator).
   * StreamSummary is trivially a bifunctor. I actually wanted to make it an
   instance of Bifunctor, but it was in the category-extras package and I
   hesitated to reference this giant just for this purpose :) Probably
   bifunctors should be in prelude.
 
  Edward Kmett has been splitting that up into a variety of smaller
  packages, for instance:
 
  http://hackage.haskell.org/package/bifunctors
 
 Actually it's not a bifunctor - it's a functor in one argument and
 contrafunctor in the other.
 Is there a name for such a structure?

Bifunctor is usually used for such things as well.  Data.Bifunctor
only covers bifunctors which are covariant in both arguments.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Images in Haddock documentation: best practices?

2011-12-24 Thread Brent Yorgey
Hi all,

Although it doesn't seem to be documented in the user manual (!),
Haddock supports inline images, using a url syntax.  I'd like to
include some images in the documentation for a package I'm writing,
but not sure of the best way.

I can, of course, just make the images available under my UPenn
personal web space, and link to them from the documentation.  But this
seems fragile and ad-hoc.  Ideally, I'd like to bundle the images
along with the cabal package, and reference them locally from within
the documentation.  But I haven't figured out a way to do this.

Any ideas?  Has anyone ever included images in Haddock docs before?
Is it possible to bundle them with the package and refer to them
locally?  Or does anyone have any other suggestions?  Are there
specific ways Haddock and/or cabal could be improved to make this
easier?

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Alternative] some/many narrative

2011-12-15 Thread Brent Yorgey
On Thu, Dec 15, 2011 at 07:29:20PM +1300, Chris Wong wrote:
  Okay, so how about the following as a user narrative for some and many?
 
  ...
 
 I was in the middle of writing my own version of Applicative when I
 stumbled on this intense debate. Here's what I wrote for the
 documentation:
 
 class (Applicative f, Monoid f) = Alternative f where

Note that 'Monoid f' does not make sense, since the kinds do not
match. Perhaps what you mean is  (forall a. Monoid (f a)) but that is
(currently) impossible to express.  One could, of course, make a new
typeclass

  class Monoid1 f where
mempty1 :: f a
mappend1 :: f a - f a - f a

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Alternative versus Monoid

2011-12-15 Thread Brent Yorgey
On Thu, Dec 15, 2011 at 06:49:13PM +1000, Gregory Crosswhite wrote:
 
 So at the end of the day... what is the point of even making Maybe and [] 
 instances of Alternative?

The Alternative and Monoid instances for [] are equivalent.  However,
the Alternative and Monoid instances for Maybe are not. To wit:

   (Just (Sum  4)) | (Just (Sum 3))
  Just (Sum {getSum = 4})

   (Just (Sum 4)) `mappend` (Just (Sum 3))
  Just (Sum {getSum = 7})

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Alternative] some/many narrative

2011-12-15 Thread Brent Yorgey
On Thu, Dec 15, 2011 at 09:34:14AM -0800, Bryan O'Sullivan wrote:
 On Wed, Dec 14, 2011 at 10:29 PM, Chris Wong 
 chrisyco+haskell-c...@gmail.com wrote:
 
 -- [Warning]: This is only defined for actions that eventually fail
 -- after being performed repeatedly, such as parsing. For pure values
  such
 -- as 'Maybe', this will cause an infinite loop.
 
 
 If an action of type Maybe a is written to always and unconditionally
 return Just some-value-or-other, *that's* when some or many will

The way you phrased this sounds odd to me.  Every action/value of type
Maybe a will *either* always and unconditionally be Nothing, OR
always and unconditionally be Just some-value-or-other.  By
referential transparency, those are the only options.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Alternative versus Monoid

2011-12-15 Thread Brent Yorgey
On Thu, Dec 15, 2011 at 09:05:13PM +, Conor McBride wrote:
 
 On 15 Dec 2011, at 15:19, Brent Yorgey wrote:
 
 On Thu, Dec 15, 2011 at 06:49:13PM +1000, Gregory Crosswhite wrote:
 
 So at the end of the day... what is the point of even making
 Maybe and [] instances of Alternative?
 
 The Alternative and Monoid instances for [] are equivalent.  However,
 the Alternative and Monoid instances for Maybe are not. To wit:
 
 (Just (Sum  4)) | (Just (Sum 3))
  Just (Sum {getSum = 4})
 
 (Just (Sum 4)) `mappend` (Just (Sum 3))
  Just (Sum {getSum = 7})
 
 The current monoid instance for Maybe is, in my view, unfortunate.
 
 Types are about semantic purpose, not just data representation.
 Many purposes can be represented in the same way. We should identify
 the purpose of a type (or type constructor), then define instances
 consistent with that purpose. And better, we acquire by instance
 inference compound instances consistent with that purpose! (A similar
 view is often articulated well by Conal Elliott. But perhaps it's
 just a Con thing.)
 
 The purpose of Maybe, it seems to me, is to model failure and
 prioritized choice, after the manner of exceptions. It's clear
 what the failure-and-prioritized-choice monoid is.
 
 It so happens that the same data representation can be used to make
 a semigroup into a monoid by attaching an identity element. That's
 a different semantic purpose, which deserves a different type.

I agree.  Moreover, the current Monoid instance for (Maybe a) does not
even achieve this, since it requires a *Monoid* instance on a, rather
than a semigroup.  

Note that the 'semigroups' package defines an 'Option' type which does
lift Semigroup instances to Monoid instances.  I, for one, would be
quite in favor of changing the current Monoid (Maybe a) instance to
correspond to the failure-and-prioritized-choice semantics (i.e. the
semantics currently given to the 'First' wrapper).

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: hxournal-0.5.0.0 - A pen notetaking program written in haskell

2011-12-14 Thread Brent Yorgey
On Wed, Dec 14, 2011 at 04:53:38PM +0100, Ivan Perez wrote:
 I think not. The version in hackage is still hxournal-0.5.0.0. Unless,
 of course,
 you can update a package that's already been submitted without increasing the
 version number. Is that possible? (I actually don't know)

Thankfully, it is not.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Chuan-Kai Lin's Unimo framework

2011-12-12 Thread Brent Yorgey
On Mon, Dec 12, 2011 at 03:17:38PM +0100, Jean-Luc Delatre wrote:
 Does anybody has an hands on experience of using Chuan-Kai Lin's Unimo 
 framework?

No, but if you want to define monads operationally I would instead
recommend using the 'operational' package:

  http://hackage.haskell.org/package/operational

It does actually have examples.  Anyway, it seems like Unimo is not
even on Hackage.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [ANNOUNCEMENT] xmobar 0.14

2011-12-11 Thread Brent Yorgey
On Sun, Dec 11, 2011 at 05:09:44PM +0400, Sergey Mironov wrote:
 
 Hi. I am Awesome WM user thinking about swithcing to the xmonad. Could I
 take an opportunity and ask about mouse support in xmonad/xmobar ?
 Actually, I assume that xmobar does nothing with mouse, but what is a
 common way of showing something like main menu to the user? Is there an
 option of switching windows with mouse by pressing on some window's icon,
 just like common DE does?

Yes, see 

  http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-EwmhDesktops.html

xmonad itself does not provide something which the user can click on
to switch windows, but if you use some other window-switcher program
(e.g. one that comes with your favorite DE) the above module can be
used to make xmonad to respond to it.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] More liberal than liberal type synonyms

2011-12-08 Thread Brent Yorgey
On Wed, Dec 07, 2011 at 04:47:47PM +0100, Gábor Lehel wrote:
 On Wed, Dec 7, 2011 at 1:07 PM, Dmitry Kulagin dmitry.kula...@gmail.com 
 wrote:
  For short, type synonyms work for mere aliases, but not for full-fledged 
  type-level non-inductive functions. And sometimes we intuitively want to 
  use them as such.
  Thank you, Yves! It is now more clear for me.
 
  Still, it seems that ability to use partially applied type synonyms would be
  very natural (and useful) extension to the language. It would allow to avoid
  boilerplate code associated with creating really new types instead of just
  using synonims for existing ones.
 
 The problem as I understand it is that partially-applied type synonyms
 are in effect type level lambdas, and type checking in the presence of
 type level lambdas requires higher-order unification, which is
 undecidable in general. Restricted cases might be possible, I'm not an
 expert in the field. GHC hackers could probably elaborate.
 
 [1] 
 http://stackoverflow.com/questions/8248217/are-there-type-level-combinators-will-they-exist-in-some-future
 [2]
 http://en.wikipedia.org/wiki/Unification_(computer_science)#Higher-order_unification

It's actually type *inference* that requires higher-order unification
in the presence of type-level lambdas, not type checking.  This might
not be a huge deal: we just have to clearly state that enabling
-XPartialTypeFunApps means that you may have to provide some explicit
type annotations in places where type inference cannot figure things
out.  We already have extensions like this (e.g. RankNTypes).

The bigger problem for the moment is that for various technical
reasons, enabling partial applications of type functions can lead to
unsoundness (i.e. typechecked programs which nonetheless crash at
runtime) in the way that type equality is handled.  For more details
see 

  
http://stackoverflow.com/questions/7866375/why-does-ghc-think-that-this-type-variable-is-not-injective/7950614#7950614

I agree that the ability to use partially applied type
synonyms/functions would be natural and useful.  I hope we will
eventually see a version of GHC which supports it but there are some
nontrivial technical issues to be worked out first.

-Brent

 
 
  On Wed, Dec 7, 2011 at 3:51 PM, Yves Parès limestr...@gmail.com wrote:
  Ah, maybe Dan could tell us if it works only with GHC 7.
 
  Dmitry, I had your problem many times. The last time was when I saw you
  could define the ContT monad in terms of Cont (the opposite is done in the
  mtl).
  It leads to a simpler code, but you are stucked when trying to define ContT
  as an instance of MonadTrans:
 
  data Cont r a = ...
  -- [instances of Monad Cont, blah blah blah]
 
  type ContT r m a = Cont r (m a)
 
  instance MonadTrans (ContT r) where  -- This doesn't compile, even if it is
  logical
    lift = ...
 
  For short, type synonyms work for mere aliases, but not for full-fledged
  type-level non-inductive functions.
  And sometimes we intuitively want to use them as such.
 
 
  2011/12/7 Dmitry Kulagin dmitry.kula...@gmail.com
 
   Dmitry, does your code work with LiberalTypeSynonyms extention
   activated?
  No, the same error:
  Type synonym `StateA' should have 1 argument, but has been given 0
 
  But I have GHC 6.12.3
 
  Dmitry
  2011/12/7 Yves Parès limestr...@gmail.com:
   This is impossible:
   in the definition of 'StateT s m a', m must be a monad and then have the
   *
   - * kind.
   So you cannot pass (StateA a), because it has simply the * kind.
  
   Dmitry, does your code work with LiberalTypeSynonyms extention
   activated?
  
  
   2011/12/7 Øystein Kolsrud kols...@gmail.com
  
   You should be able to write something like this:
  
   type StateB a b = StateT SomeOtherState (StateA a) b
  
   Best regards, Øystein Kolsrud
  
  
   On Wed, Dec 7, 2011 at 11:48 AM, Dmitry Kulagin
   dmitry.kula...@gmail.com
   wrote:
  
   Hi Dan,
  
   I am still pretty new in Haskell, but this problem annoys me already.
  
   If I define certain monad as a type synonym:
  
      type StateA a = StateT SomeState SomeMonad a
  
   Then I can't declare new monad based on the synonym:
  
      type StateB a = StateT SomeOtherState StateA a
  
   The only way I know to overcome is to declare StateA without `a':
  
      type StateA = StateT SomeState SomeMonad
  
   But it is not always possible with existing code base.
  
   I am sorry, if this is offtopic, but it seemed to me that the problem
   is realted to partially applied type synomyms you described.
  
   Thanks!
   Dmitry
  
   On Tue, Dec 6, 2011 at 10:59 PM, Dan Doel dan.d...@gmail.com wrote:
Greetings,
   
In the process of working on a Haskell-alike language recently, Ed
Kmett and I realized that we had (without really thinking about it)
implemented type synonyms that are a bit more liberal than GHC's.
With
LiberalTypeSynonyms enabled, GHC allows:
   
   type Foo a b = b - a
   type Bar f = f String Int
   
   

Re: [Haskell-cafe] (no subject)

2011-11-28 Thread Brent Yorgey
On Mon, Nov 28, 2011 at 04:20:54PM -0600, Antoine Latter wrote:
 On Mon, Nov 28, 2011 at 4:12 PM, Willem Obbens dub...@hotmail.com wrote:
  Hello,
  I get this error when I try to derive an instance of the Show typeclass:
  Abc.hs:21:60:
      Couldn't match expected type `Vector' with actual type `[Point]'
      In the first argument of `show'', namely `xs'
      In the second argument of `(++)', namely `show' xs'
      In the second argument of `(++)', namely `,  ++ show' xs'
  Failed, modules loaded: none.
  Here's the faulty code:
  newtype Point = Point Int
  instance Show Point where
     show (Point a) = [chr $ a + 48]
 
  data Vector = Vector [Point]
  instance Show Vector where
     show (Vector ys) =
        let show' (Vector [z])     = show z
            show' (Vector (x:xs))  = show x ++ ,  ++ show' xs
            show' (Vector [])      = []
        in  ( ++ show' ys ++ )

You've made  show' :: Vector - String, but I'm guessing you actually
want to make it  show' :: [Point] - String; i.e. get rid of the
Vector constructors in the show' patterns.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A Mascot

2011-11-17 Thread Brent Yorgey
On Thu, Nov 17, 2011 at 10:28:47AM +0100, Alexander Bernauer wrote:
 On Tue, Nov 15, 2011 at 08:18:04PM -0800, John Meacham wrote:
  People tend to concentrate on the lambda which cooresponds to the
  functional aspect of haskell when designing logos. Not nearly enough
  attention is paid to the other striking feature, the laziness.
 
 If we want to emphasize the lazyness, why not a sloth instead of a lamb?
 
 http://en.wikipedia.org/wiki/Sloth - is this cute or what ;-)

Sloths are not lazy, they are just slow.  I doubt that's the
impression we want to give of Haskell. =)

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] capri cabal-dev virtualenv cab

2011-11-08 Thread Brent Yorgey
On Tue, Nov 08, 2011 at 10:04:20AM -0800, Rogan Creswick wrote:
 On Mon, Nov 7, 2011 at 11:40 PM, Rustom Mody rustompm...@gmail.com wrote:
  Does anyone give me a little comparison of these?
 
 virtualenv:
 
 I'm not familiar with virtualenv, but from skimming the site, it looks
 like it does something very similar to cabal-dev, but focused on
 python.  I'm not sure if it can be used with other languages /
 arbitrary tools or not.

I'm guessing the OP was actually referring to 'virthualenv', which was
recently released and works with Haskell (but is similar to virtualenv
for python).  It seems that virthualenv lets you set up independent
environments including sandboxed builds and custom versions of GHC,
etc., and switch between them.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-26 Thread Brent Yorgey
On Wed, Oct 26, 2011 at 09:15:41AM -0700, Nathan Howell wrote:
 On Wed, Oct 26, 2011 at 6:53 AM, Magicloud Magiclouds 
 magicloud.magiclo...@gmail.com wrote:
 
   But in Haskell, could I write a code to list the classes that a type
  instanced?
   TemplateHaskell as well.
 
 
 It's possible with TemplateHaskell. Look at classInstances and the ClassI
 data constructor.
 
 http://haskell.org/ghc/docs/7.0.4/html/libraries/template-haskell-2.5.0.0/Language-Haskell-TH.html#v:classInstances

No, this lists all the instances of a class.  OP asked for the classes
of which a given type is an instace.

Presumably it is possible, since Haddock does it!  In the
documentation generated for a type it lists classes of which the type
is an instance.  So you might want to look at how Haddock does it.  I
suspect the only way is through the GHC API.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Is it possible to get the information of instances of a type?

2011-10-26 Thread Brent Yorgey
On Wed, Oct 26, 2011 at 09:10:23PM +0400, MigMit wrote:
 Can't be done. Even if this particular module doesn't contain
 instance Class Type, it's quite possible that the said instance
 would be defined in another module, about which this one knows
 nothing about.

That doesn't mean it can't be done, only that you would have to be
explicit about which modules to look in.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Monad.Reader Issue 19

2011-10-26 Thread Brent Yorgey
I am pleased to announce that Issue 19 of The Monad.Reader, a special
issue on parallelism and concurrency, is now available:

  http://themonadreader.files.wordpress.com/2011/10/issue19.pdf

Issue 19 consists of the following three articles:

  * Mighttpd – a High Performance Web Server in Haskell 
by Kazu Yamamoto 

  * High Performance Haskell with MPI 
by Bernie Pope and Dmitry Astapov

  * Coroutine Pipelines 
by Mario Blažević

Feel free to browse the source files. You can check out the entire
repository using darcs:

  darcs get http://code.haskell.org/~byorgey/TMR/Issue19

If you’d like to write something for Issue 20, please get in
touch. The deadline will likely be in December; more details will be
forthcoming.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-25 Thread Brent Yorgey
On Mon, Oct 24, 2011 at 11:55:53AM -0700, David Barbour wrote:
 Thanks.
 
 Diagrams package seems it could be promising for a declarative UI model -
 i.e. integration with functional reactive programming and similar models -
 so long as I'm willing to sacrifice `native` look and feel, which doesn't
 seem like a big problem.

Yes, I imagine it could.  Not one of the use cases I personally had in
mind -- but I've been hoping that people will find it useful for
things I had not thought of.

 
 A couple more questions:
 1) Am I right in assuming that Diagrams does very little `occlusion` of its
 own - i.e. when rendering a soda-straw view of a complex diagram, or masking
 large areas with a rectangle or sphere? There won't be any competition or
 redundancy with an external index and backend (e.g. Cairo-GL layer)
 occlusion?

Right, diagrams currently doesn't do any sort of culling, occlusion,
etc., that's all up to the backend.

 2) Is there support for Cairo-like linear and radial gradients?

Not yet, but it's on the todo list.

 Also, it seems that for Cairo rendering, we cannot currently supply our own
 Cairo context.
 
  renderDia Cairo (CairoOptions foo.png (PNG (100,100))) myDiagram
 
 This section of your manual is incomplete, I admit, but from browsing the
 code it seems you provide a simplified interface that fully encapsulates the
 Cairo rendering. Is there any way to render a diagram within the Cairo
 stack? or leverage Cairo's own experimental backends (like OpenGL)?

You're right, currently there's no way do these sorts of things.
However, there's no fundamental limitation here and adding this sort
of functionality should not be hard, and I'd be quite open to
extending the cairo backend in this direction.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-25 Thread Brent Yorgey
On Mon, Oct 24, 2011 at 01:58:33PM -0700, Jason Dagit wrote:
 On Sun, Oct 23, 2011 at 11:47 AM, Brent Yorgey byor...@seas.upenn.edu wrote:
  I am pleased to announce the release of version 0.4 of diagrams, a
  full-featured framework and embedded domain-specific language for
  declarative drawing.
 
 What do you use for text support?  I know at one point you were
 interested in my freetype2 binding (which is still very raw and
 immature), but you must be using gtk for font loading and rendering?

At the moment, text is completely delegated to backends.  diagrams
itself doesn't do any font loading or rendering at all.  However, the
obvious downside to this is that the framework itself has no idea how
big a given piece of text is and can't position it relative to other
things.  On the todo list is to use your freetype2 binding (or
something like it) to actually do more work within the framework
itself, so it can position text correctly, convert text outlines into
paths, and so on.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-24 Thread Brent Yorgey
On Mon, Oct 24, 2011 at 08:21:30AM +0530, Rustom Mody wrote:
 Thanks.  This is attractive.
 I remember (vaguely) a 'live page' ie where one could enter (into the
 browser) changes to the diagrams code and see the results immediately.
 Is that page there? (Or am I mixing up with something else?)

You might also have been thinking of Luite Stegeman's Wolfgang
Lambda project, which supports diagrams in this way (as well as many
other things!).  There was an early preview version of it up for a
little while which a bunch of people saw, but it's not ready for
release yet.

 How does diagrams compare with graphviz?  If this is an inappropriate
 (type-wrong?) question thats ok :-)  Its just that when I last looked at
 graphviz I found the documentation somewhat impenetrable -- like much else
 in Hackage -- lots of types, no examples.

graphviz is a special-purpose tool for doing graph layout and
visualization.  diagrams is a general-purpose framework for drawing
anything at all.  As for documentation, you do realize that the graphviz
package on Hackage is a set of bindings? So there's a lot of helpful
documentation at http://www.graphviz.org/ .

One of my goals with diagrams is to have excellent documentation, so
if you find anything that is unclear or poorly documented, please file
a bug report (http://code.google.com/p/diagrams/issues/list)!

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: diagrams 0.4

2011-10-24 Thread Brent Yorgey
On Mon, Oct 24, 2011 at 03:46:26PM +1100, Ivan Lazar Miljenovic wrote:
 
 Hmmm... might be interesting to try and use dot/neato/etc. to do the
 layout of a graph, and then use diagrams for the actual
 visualisation...

I agree!  This has been on my list of
things-to-do-with-diagrams-eventually for quite a while. It shouldn't
even be very hard since your graphviz bindings can so nicely
round-trip a graph description through dot/neato/etc. (right?)
graphviz is great at graph layout but not so hot at graph *drawing*.

-Brent

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


  1   2   3   4   5   >