[Haskell-cafe] Which builder to choose?

2013-09-20 Thread Alejandro Serrano Mena
Hi,
I'm looking at the packages blaze-builder and bytestring, and both provide
builders for ByteString.
Which one should I use? In which situations is one more convenient than the
other?

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


Re: [Haskell-cafe] future (editor) of HCAR?

2013-09-18 Thread Alejandro Serrano Mena
I would be delighted to take the full responsibility (or just help) in the
HCAR.
I have some ideas, maybe I could get some time later to write them down.


2013/9/18 Janis Voigtlaender j...@informatik.uni-bonn.de

 Dear all,

 The Haskell Communities and Activities Report has been produced twice a
 year for more than ten years now:

 http://www.haskell.org/**haskellwiki/Haskell_**Communities_and_Activities_
 **Reporthttp://www.haskell.org/haskellwiki/Haskell_Communities_and_Activities_Report

 I have been responsible for producing it the last few years, which was
 fun. I am now looking to pass that on, handing over the HCAR to someone
 else. Any takers?

 Editing HCAR is a few days work per year, but it is also a great way to
 be involved in the Haskell community - you get a lot of news first hand.
 There are various procedures in place that automate some of the work,
 and if someone is interested in taking over, I'm very willing to help
 along, for example producing the next edition of the report together for
 a smooth transition.

 Below I attach the previous call for contributions, which also answers
 some basic questions about the report. For further questions about the
 process etc., anybody interested simply get in touch with me.

 Also, such a transition is a good opportunity to rethink model and
 processes. Maybe you (anybody on the mailing list) have completely new
 ideas for how the HCAR should be organized? How it could function
 better? What other purposes it could serve than it has so far? ...
 (Or even that HCAR in its existing form is not needed anymore, but could
 be replaced by something great new?)

 Best,
 Janis.


  Original-Nachricht 
 Betreff: Call for Contributions - Haskell Communities and Activities
 Report, May 2013 edition
 Datum: Mon, 08 Apr 2013 21:56:19 +0200
 Von: Janis Voigtländer j...@informatik.uni-bonn.de
 An: Haskell hask...@haskell.org

 Dear all,

 I would like to collect contributions for the 24th edition of the

 ==**==**
  Haskell Communities  Activities Report

 http://www.haskell.org/**haskellwiki/Haskell_**Communities_and_Activities_
 **Reporthttp://www.haskell.org/haskellwiki/Haskell_Communities_and_Activities_Report

 Submission deadline: 1 May 2013

  (please send your contributions to hcar at haskell.org,
  in plain text or LaTeX format)
 ==**==**

 This is the short story:

 * If you are working on any project that is in some way related
   to Haskell, please write a short entry and submit it. Even if
   the project is very small or unfinished or you think it is not
   important enough --- please reconsider and submit an entry anyway!

 * If you are interested in an existing project related to Haskell that
   has not previously been mentioned in the HCAR, please tell me, so
   that I can contact the project leaders and ask them to submit an
   entry.

 * Feel free to pass on this call for contributions to others that
   might be interested.

 More detailed information:

 The Haskell Communities  Activities Report is a bi-annual overview of
 the state of Haskell as well as Haskell-related projects over the
 last, and possibly the upcoming six months. If you have only recently
 been exposed to Haskell, it might be a good idea to browse the
 previous edition --- you will find interesting projects described as
 well as several starting points and links that may provide answers to
 many questions.

 Contributions will be collected until the submission deadline. They
 will then be compiled into a coherent report that is published online
 as soon as it is ready. As always, this is a great opportunity to
 update your webpages, make new releases, announce or even start new
 projects, or to talk about developments you want every Haskeller to
 know about!

 Looking forward to your contributions,

 Janis (current editor)


 FAQ:

 Q: What format should I write in?

 A: The required format is a LaTeX source file, adhering to the template
 that is available at:

  
 http://haskell.org/**communities/05-2013/template.**texhttp://haskell.org/communities/05-2013/template.tex

 There is also a LaTeX style file at

  
 http://haskell.org/**communities/05-2013/hcar.styhttp://haskell.org/communities/05-2013/hcar.sty

 that you can use to preview your entry. If you do not know LaTeX, then
 use plain text. If you modify an old entry that you have written for an
 earlier edition of the report, you should already have received your old
 entry as a template (provided I have your valid email address). Please
 modify that template, rather than using your own version of the old
 entry as a template.

 Q: Can I include Haskell code?

 A: Yes. Please use lhs2tex syntax (http://people.cs.uu.nl/**
 andres/lhs2tex/ http://people.cs.uu.nl/andres/lhs2tex/).
 The report is compiled in mode polycode.fmt.

 

Re: [Haskell-cafe] resources on static analysis

2013-09-10 Thread Alejandro Serrano Mena
If you are interested in general program analysis, I recommend you the book
Principles of Program Analysis ]
http://www.amazon.com/Principles-Program-Analysis-Flemming-Nielson/dp/3540654100].
It's very complete, and covers the most important kind of analyses that you
can do (data-flow, constraint-based, abstract interpretation and
type-and-effect systems - the latter is the nearest to Haskell).

If you are interested in analyses that infer relations such as the one
shown above, you can check at size and cost analyses. Here are some
pointers:
- RAML [http://raml.tcs.ifi.lmu.de/] is based on ML, and includes in its
types information about the memory used by each function,
- The PhD thesis of Vasconcelos [
http://www.ncc.up.pt/~pbv/research/PB_Vasconcelos_PhD_thesis.pdf] uses
types with sizes to infer relations between the sizes of the arguments in a
call. It uses Haskell, so it may be the most relevant one,
- In my group we've done some work about size and resource analysis [
http://arxiv.org/abs/1308.3940]. It's Prolog-based, but the ideas are
general and could be applied to your case.


2013/9/10 Ian Ross i...@skybluetrades.net

 Not specifically about Haskell, but I read some lecture notes on this
 topic yesterday (by Michael Schwartzbach, PDF here:
 http://lara.epfl.ch/web2010/_media/sav08:schwartzbach.pdf).  The notes do
 a good job of explaining how you set up lattices for various kinds of
 analyses, and how calculating fixed points over those lattices can yield
 various sorts of interesting information.  Most of the examples are based
 on a simple imperative language, but much of the analysis is applicable to
 Haskell as well.


 On 10 September 2013 13:15, Maarten Faddegon 
 haskell-c...@maartenfaddegon.nl wrote:

 Dear list,

 I am interested in learning more about static analysis of Haskell code.
 Specifically of the relation between arguments of recursive and
 non-recursive calls.

 For example if we look at the ++ function from Prelude:

 (++) [] ys = ys
 (++) (x:xs) ys = x : xs ++ ys

 amongst others, we could infer the relations:

 ys_i+1 = ys_i
 (x:xs)_i+1 = xs_i

 Searching the web I found several tools (HLint, Haskabelle, Sourcegraph),
 but I am interested in the theory behind this. If you could recommend a
 paper or a book on this topic I would be grateful.

 Thanks,
   Maarten Faddegon
 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe




 --
 Ian Ross   Tel: +43(0)6804451378   i...@skybluetrades.net
 www.skybluetrades.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] GHC API + Cabal API + Cabal version checks: is there a way out?

2013-09-06 Thread Alejandro Serrano Mena
I'm willing to help in the process, if some directions were given to me on
how to tackle this problem.

In any case, for me is seems fine to have a dependency from cabal to ghc,
the only problem is the converse: ghc depending on cabal. Is this right?


2013/9/6 Herbert Valerio Riedel h...@gnu.org

 On 2013-09-06 at 15:13:58 +0200, Yuri de Wit wrote:
  I spent some time looking into the touch points between ghc and cabal in
  the past, and the first oddity i saw was a direct dependency from ghc to
  the cabal sources. After taking a closer look it seems that ghc shares
 some
  common, low level modules with cabal that didnt seem to justify the whole
  dependency.
 
  The right solution, imho, is to review these dependencies and move the
 low
  level ones out into a separate package that is shared by both ghc and
 cabal
  and that will rarely change. The direct side effect of this is that ghc
  would not be tied directly to a specific cabal version and you would
  not have to deal with this issue.

 [...]

 fyi, a similiar/related discussion took place few months ago on ghc-devs:

  http://www.haskell.org/pipermail/ghc-devs/2013-March/000800.html

 hth,
   hvr

 ___
 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] Tutorial on JS with Haskell: Fay or GHCJS?

2013-09-04 Thread Alejandro Serrano Mena
Hi,
I'm currently writing a tutorial on web applications using Haskell. I know
the pros and cons of each server-side library (Yesod, Snap, Scotty, Warp,
Happstack), but I'm looking for the right choice for client-side
programming that converts Haskell to JavaScript. I've finally come to Fay
vs. GHCJS, and would like your opinion on what's the best to tackle. My
current list of pros and cons is:

Fay
===
Pros:
- Does not need GHC 7.8
- Easy FFI with JS
- Has libraries for integration with Yesod and Snap

Cons:
- Only supports a subset of GHC (in particular, no type classes)


GHCJS
==
Pros:
- Supports full GHC
- Easy FFI with JS
- Highly opinionated point: will stay longer than Fay (but it's very
important for not having a tutorial that is old in few months)

Cons:
- Needs GHC 7.8 (but provides a Vagrant image)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Tutorial on JS with Haskell: Fay or GHCJS?

2013-09-04 Thread Alejandro Serrano Mena
I haven't looked at Haste too much, I'll give it a try.

My main problem is that I would like to find a solution that will continue
working in years (somehow, that will became the solution for generating
JS from Haskell code). That's why I see GHCJS (which just includes some
patches to mainstream GHC) as the preferred solution, because it seems the
most probable to continue working when new versions of GHC appear.


2013/9/4 Niklas Hambüchen m...@nh2.me

 Hi, I'm also interested in that.

 Have you already evaluated haste?

 It does not seem to have any of your cons, but maybe others.

 What I particularly miss from all solutions is the ability to simply
 call parts written in Haskell from Javascript, e.g. to write `fib` and
 then integrate it into an existing Javascript application (they are all
 more interested in doing the other direction).

 On Wed 04 Sep 2013 17:14:55 JST, Alejandro Serrano Mena wrote:
  Hi,
  I'm currently writing a tutorial on web applications using Haskell. I
  know the pros and cons of each server-side library (Yesod, Snap,
  Scotty, Warp, Happstack), but I'm looking for the right choice for
  client-side programming that converts Haskell to JavaScript. I've
  finally come to Fay vs. GHCJS, and would like your opinion on what's
  the best to tackle. My current list of pros and cons is:
 
  Fay
  ===
  Pros:
  - Does not need GHC 7.8
  - Easy FFI with JS
  - Has libraries for integration with Yesod and Snap
 
  Cons:
  - Only supports a subset of GHC (in particular, no type classes)
 
 
  GHCJS
  ==
  Pros:
  - Supports full GHC
  - Easy FFI with JS
  - Highly opinionated point: will stay longer than Fay (but it's very
  important for not having a tutorial that is old in few months)
 
  Cons:
  - Needs GHC 7.8 (but provides a Vagrant image)
 
 
  ___
  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] Job opportunities at Galois

2013-06-27 Thread Alejandro Serrano Mena
Hello,
Are there any specific details to consider when applying? For example, is
living in the US or having a visa required for application?

Thanks in advance.


2013/6/27 Iavor Diatchki iavor.diatc...@gmail.com

 Hello,

 Galois is hiring!  We're looking for researchers, principal investigators,
 and software engineers, including those with expertise in functional
 programming, formal methods, computer security, control systems,
 informatics, or networking.

 For more information, take a look at http://corp.galois.com/careers and
 please feel free to drop me an e-mail if you have questions.

 Cheers,
 -Iavor



 ___
 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 FP with Haskell

2013-05-21 Thread Alejandro Serrano Mena
Maybe you could look at Helium [
http://www.cs.uu.nl/wiki/bin/view/Helium/WebHome].
From what I understand, it's a subset of Haskell specially designed for
teaching. I heard that it provides also very good error messages and hints
about typical errors.


2013/5/21 Rustom Mody rustompm...@gmail.com

 We are offering a MOOC on haskell :

 https://moocfellowship.org/submissions/the-dance-of-functional-programming-languaging-with-haskell-and-python

 Full Announcement on beginners list :
 http://www.haskell.org/pipermail/beginners/2013-May/012013.html

 One question that I have been grappling with in this regard:
 How to run ghc in lightweight/beginner mode?

 2 examples of what I mean:

 1. gofer used to come with an alternative standard prelude -- 'simple.pre'
 Using this, gofer would show many of the type-class based errors as
 simple (non-type-class based) errors.
 This was very useful for us teachers to help noobs start off without
 intimidating them.
 2. Racket comes with a couple of levels.  The easier numbers were not
 completely consistent with scheme semantics, but
 was gentle to beginners

 Any thoughts/inputs on this will be welcomed

 Rusi

 ___
 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] list comprehension doesn't work

2013-05-14 Thread Alejandro Serrano Mena
For a first sight, you cannot use x - [0..]*[0..] to mean 'all possible
pairs x = a*b'.
You would need to do something like
[ (a*b, y) | a - [0..], b - [0..], a*b  5, a*b  500, and the rest of
things ]


2013/5/14 John knowledge1...@gmail.com

 Hi,

 I have to write a function which returns a list of all pairs (x,y) where x,
 y ∈ N AND:
 –  x is the product of two natural numbers (x = a · b, where a, b ∈ N) AND
 –  x is really bigger than 5 but really smaller than 500, AND
 –  y is a squer number (y = c² where c ∈ N) NOT greater than 1000, AND
 –  x is a divisor of y.

 My attempt is as follows:

 listPairs :: [(Int, Int)]
 listPairs = [(x,y) | x-[0..], y-[0..], x-[0..]*[0..], x  5, x  500,
 (y*y)  1001, mod y x == 0]

 However it doesn't work unfortunatly

 Could anyone tell me where my mistake is?

 Thanks.



 --
 View this message in context:
 http://haskell.1045720.n5.nabble.com/list-comprehension-doesn-t-work-tp5730158.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] Contravariant applicatives, monads and arrows (was ANN: rematch, an library for composable assertions with human readable failure messages)

2013-04-16 Thread Alejandro Serrano Mena
Hi,
First of all, let me say that this work on matchers is really useful :)

Following Roman advice, I'm trying to find a more principled approach
that could be useful for this library. It seems that Match could
easily be converted to Either and thus made into Functor, Applicative,
Alternative and Monad. That would allow to write things like:

User $ runMatch (isNot isEmpty) name * runMatch (hasItem (is '@')) email

However, I'm also thinking about the correct way to combine matchers
to get bigger matchers. Basically, if I have matchers on every field
of a record, can I get a matcher for the entire one?

My first idea was to make Matcher a functor. However, what I come was
a contravariant functor: given (a - b) and Matcher b, I can easily
construct a Matcher a by running the one in b over this function. So
we have:

contramap :: (a - b) - Matcher b - Matcher a

My first question is: is there any structure similar to applicative
functors or monads which work on these kind of contravariant functors?
This also brought into my mind to see Matcher a just as functions a -
Match and derive its properties from there. This may give better
results that the above mentioned idea of looking it as a - Either
String a, because in this latter case we have a in covariant and
contravariant positions and it's difficult to get anything.

On the other hand, it seems very easy, from a Matcher a and a Matcher
b, to get a Matcher (a,b). This reminds me a bit about arrows, but
without output parameters. Does it make sense? I've always been
reluctant to arrows because I don't fully understand them, but maybe
this is a good moment to learn.

Do any of this make sense? I would really like to contribute to this
great library! :)

2013/4/16 Tom Crayford tcrayf...@gmail.com:
 Roman,

 Thanks for the feedback! I'd originally left the QuickCheck and HUnit
 implementations in this library for convenience, thinking that there aren't
 going to be many people who care about the transitive dep. But you care, so
 I'm happy moving them out of core. I'll release a 0.2 with both the HUnit
 and the QuickCheck runners in separate libraries soonish.

 Thanks for the haddock tip and the implementation tips.

 Re the Control namespace, these matchers aren't exclusively a testing tool.
 I've been using the core api for other purposes as well (primarily for
 validating forms in user interfaces in conjunction with digestive-functors).
 I couldn't figure anything better to put it in apart from Control (I
 definitely don't want it in Test, even though that's going to be what most
 people use it for). I guess it could be in `Data`, but that doesn't sound
 much better to me.

 I'm not amazingly strong at building more principled interfaces right now,
 so I guess that's something I'll improve on. Are there any concrete
 suggestions you have there? I'd *like* these to have an `Alternative`
 instance, but making `Applicative`/`Functor` instances is beyond me right
 now (I guess I'd have to change the core API for that to work out).

 Tom


 ...

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


[Haskell-cafe] Haskell / Functional Programmers Group in Madrid (Spain)?

2013-04-10 Thread Alejandro Serrano Mena
Hi,
Is there any Haskell or functional programmers user group in the region of
Madrid?

If not, I think it could be a great idea to get to know each other, and
share experiences. Furthermore, we could try to organize some meetings with
presentations, hackatons and so on (my personal ambition is to be able to
organize another ekmett Workshop as the Japanese one -
http://comonad.com/reader/2013/japanese-workshop-1/). I know there is some
locations along Madrid dedicated to open source promotion, like
http://madridonrails.com/, and which we could use for these meetings.

I'm really looking forward to hearing from you!

PS: Maybe a bare Haskell group is not big enough (at least according to
Haskellers.com), but a functional programmers one may well be.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Announcement] HsLlvm v0.1: Using Hoopl to optimize LLVM Code

2013-02-11 Thread Alejandro Serrano Mena
Hi,
This seems a fantastic job!

Do you have any plan to support LLVM - target phase, or do you know any
project doing something similar?

Thanks in advance.


2013/2/11 Ning Wang em...@ningwang.org

 Hi all,

 It is my dream for years to be able to manipulate LLVM in type safe
 language. I has explored the possibility of reimplementing LLVM in Haskell
 with Hoopl and made a small step to realize this dream. I am writing to
 announce the release of HsLlvm v0.1, which is a pure Haskell implementation
 (Not LLVM C++ binding) of LLVM. It is available through the link below.

 https://github.com/mlite/**HsLlvm https://github.com/mlite/HsLlvm

 Hightlight of this release:
 - Support LLVM 3.1 syntax
 - LLVM normalization
 - Dominator, mem2reg, DCE passes


 Project goals:
 - port all LLVM optimizations
 - provide functionalities to generate and manipulate LLVM code.

 Since LLVM is a complex IR and there are many sophisticated optimizations,
 this job won't be easy.  Your contribution would be of value to eventually
 achieve this goal.

 Cheers,
 Ning




 __**_
 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


Re: [Haskell-cafe] How to take a minimum sub list that only contain certain number of elements of certain type?

2012-09-25 Thread Alejandro Serrano Mena
It also comes to my mind that you can use something similar to regular
expressions and parsing, seeing your list as a word made of Int elements. I
think you can achieve it using Parsec or attoparsec.
One you define your basic combinators for 'odd', you can see your sublist
as the minimal part of the list matching
(even* odd)(even* odd)(even* odd)(even* odd)

2012/9/25 Ivan Lazar Miljenovic ivan.miljeno...@gmail.com

 On 25 September 2012 16:51, Magicloud Magiclouds
 magicloud.magiclo...@gmail.com wrote:
  Hi,
For example, I have an array [0..]. Now I want to take a sub list
  that starts from index 0, and only contain 4 odds, and is minimum
  result. The answer should be [0, 1, 2, 3, 4, 5, 6, 7].

 If you have listTest :: [a] - Bool, then head . dropWhile (not .
 listTest) . inits ?

How to do that? Combining lazy computing, I cannot figure out an
  efficient algorithm.
  --
  竹密岂妨流水过
  山高哪阻野云飞
 
  And for G+, please use magiclouds#gmail.com.
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe



 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 http://IvanMiljenovic.wordpress.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


Re: [Haskell-cafe] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
I don't know whether this is really applicable but: isn't emptyStack in
Ertugrul last message some kind of constructor? You can add any kind of
special constructors as functions in the type class which return a new
queue. For example:

class Stack s where
  newEmptyStack :: s a
  newSingletonStack :: a - s a
  ...

Why doesn't this fulfill you needs of specifying ways to construct new
elements?

2012/7/23 Patrick Browne patrick.bro...@dit.ie



 On 22/07/12, *Ertugrul Söylemez * e...@ertes.de wrote:



 You are probably confusing the type class system with something from
 OOP.  A type class captures a pattern in the way a type is used.  The
 corresponding concrete representation of that pattern is then written in
 the instance definition:



 No really. I am investigating the strengths and weaknesses of type classes
 as a *unit of specification*.
 I am aware that their primarily intended to act as interface description,
 which I suppose is a form of specification.
 To what degree could the QUEUE_SPEC (repeated below) from my first posting
 be expressed as a type class?
 From the feedback, I get the impression that an abstract specification
 such as QUEUE_SPEC cannot be expressed as a type class (as an instance yes).
 The stumbling block seems to be the abstract representation of
 constructors.
 In [1]  the classes Moveable and Named are combined, but again each of
 these classes are pure signatures.

 Regards,
 Pat
 [1]Haskell: The Craft of Functional Programming (Second Edition) Simon
 Thompson, page 270



 module QUEUE_SPEC where
 data Queue e   = New | Insert (Queue e) e deriving Show

 isEmpty :: Queue  e  - Bool
 isEmpty  New  = True
 isEmpty (Insert q e) = False

 first :: Queue  e  - e
 first (Insert q e) =  if (isEmpty q) then e else (first q)


 rest :: Queue  e  - Queue  e
 rest (Insert  q e ) = if (isEmpty q) then New  else (Insert (rest q) e)


 size :: Queue  e  - Int
 size New  = 0
 size (Insert q e) = succ (size q)

 {-
 some tests of above code
 size (Insert (Insert (Insert New 5) 6) 3)
 rest (Insert (Insert (Insert New 5) 6) 3)



 Tá an teachtaireacht seo scanta ó thaobh ábhar agus víreas ag Seirbhís
 Scanta Ríomhphost de chuid Seirbhísí Faisnéise, ITBÁC agus meastar í a
 bheith slán. http://www.dit.ie
 This message has been scanned for content and viruses by the DIT
 Information Services E-Mail Scanning Service, and is believed to be clean.
 http://www.dit.ie

 ___
 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] specifying using type class

2012-07-23 Thread Alejandro Serrano Mena
I think you are confusing ADTs, type classes and default declarations in
type classes. In Haskell, values are truly created only via abstract data
types. That would be a specific instance of your class:

data Stack a = Empty | Top a (Stack a)

Then you can write the implementation with respect to this concrete example.

What I was proposing, if you only need constructs, is that instead of
thinking of constructors, you may think of a factory pattern, similar to
that pattern in OOP: a function that creates the element for you. That
would be the newStack in your type class: every instance of a Stack must
provide a way to create new objects. However, this is just a function, so
you cannot pattern match there.

What type classes do allow you to do is to provide default implementations
of some function in you type class. But this must be a complete
implementation (I mean, executable code), not merely a specification of
some properties. For example, say you have functions in your class for
testing emptiness and poping elements. Then you may write a default
implementation of length:

class Stack s a | s - a where
  isEmpty :: s a - Bool
  pop :: s a - (a, s a)  -- Returns the top element and the rest of the
stack

  length :: s a - Int
  length stack = if isEmpty stack then 0 else (length (snd (pop stack))) + 1

However, I think that what you are trying to do is to encode some
properties of data types into the type system. This is better done using
dependent typing, which in a very broad sense allows you to use value
functions into types. For example, you may encode the number of elements of
a stack in its type (so the type would be Stack ElementType
NumberOfElements) and then you may only pop when the Stack is not empty,
which could be encoded as

pop :: Stack a (n + 1) - (a, Stack a n)

Haskell allows this way of encoding properties up to some extent (in
particular, this example with numbers could be programmed in Haskell), but
for the full power (and in my opinion, for a clearer view of what's
happening) I recommend you to look at Idris (http://idris-lang.org/) or
Agda2 (http://wiki.portal.chalmers.se/agda/pmwiki.php). A very good
tutorial for the first is
http://www.cs.st-andrews.ac.uk/~eb/writings/idris-tutorial.pdf

Hope this helps!

2012/7/23 Patrick Browne patrick.bro...@dit.ie

 Yes. I tried that, but due to my lack of Haskell expertise I cannot write
 the constructor insertC1 below:

 class QUEUE_SPEC_CLASS1 q where
  newC1 :: q a
  isEmptyC1 :: q a - Bool
  insertC1  :: q a - a - q a
  sizeC1:: q a - Int
  restC1:: q a - q a
 -- I do not know how to specify constructor insertC1 ?? =  ??
  insertC1 newC1 a = newC1
  isEmptyC1 newC1  = True
 -- isEmpty (insertC1 newC1 a) = False


 On 23/07/12, *Alejandro Serrano Mena * trup...@gmail.com wrote:

 I don't know whether this is really applicable but: isn't emptyStack in
 Ertugrul last message some kind of constructor? You can add any kind of
 special constructors as functions in the type class which return a new
 queue. For example:

 class Stack s where
   newEmptyStack :: s a
   newSingletonStack :: a - s a
   ...

 Why doesn't this fulfill you needs of specifying ways to construct new
 elements?

 2012/7/23 Patrick Browne patrick.bro...@dit.ie patrick.bro...@dit.ie



 On 22/07/12, *Ertugrul Söylemez * e...@ertes.de e...@ertes.de wrote:



 You are probably confusing the type class system with something from
 OOP.  A type class captures a pattern in the way a type is used.  The
 corresponding concrete representation of that pattern is then written in
 the instance definition:



 No really. I am investigating the strengths and weaknesses of type
 classes as a *unit of specification*.
 I am aware that their primarily intended to act as interface description,
 which I suppose is a form of specification.
 To what degree could the QUEUE_SPEC (repeated below) from my first
 posting be expressed as a type class?
 From the feedback, I get the impression that an abstract specification
 such as QUEUE_SPEC cannot be expressed as a type class (as an instance yes).
 The stumbling block seems to be the abstract representation of
 constructors.
 In [1]  the classes Moveable and Named are combined, but again each of
 these classes are pure signatures.

 Regards,
 Pat
 [1]Haskell: The Craft of Functional Programming (Second Edition) Simon
 Thompson, page 270



 module QUEUE_SPEC where
 data Queue e   = New | Insert (Queue e) e deriving Show

 isEmpty :: Queue  e  - Bool
 isEmpty  New  = True
 isEmpty (Insert q e) = False

 first :: Queue  e  - e
 first (Insert q e) =  if (isEmpty q) then e else (first q)


 rest :: Queue  e  - Queue  e
 rest (Insert  q e ) = if (isEmpty q) then New  else (Insert (rest q) e)


 size :: Queue  e  - Int
 size New  = 0
 size (Insert q e) = succ (size q)

 {-
 some tests of above code
 size (Insert (Insert (Insert New 5) 6) 3)
 rest (Insert (Insert (Insert New 5) 6) 3)



 Tá an teachtaireacht seo scanta ó thaobh ábhar agus

Re: [Haskell-cafe] Summer of Code idea: Haskell Web Toolkit

2012-03-11 Thread Alejandro Serrano Mena
That sound like a really cool project. Where could I get more information
about what could I do?
You mention about contacting but I think it's better to keep the discussion
open for everybody.

Alejandro

2012/3/11 Jurriën Stutterheim j.stutterh...@me.com

 While I might be a bit biased (I spent a good deal of time working on
 improving the UHC JS backend), I think there are a lot of opportunities to
 get Haskell as a client-side language via the UHC, as Heinrich suggested.
 Alessandro Vermeulen recently wrote an entire front-end application using
 the UHC JS backend, so we know that it's capable of producing working
 front-end applications. See also[1].

 Currently, however, it is still a bit of a pain to compile larger UHC JS
 projects, since Cabal support for UHC's different backends is limited. This
 could be one potential goal for your GSoC project: make it possible to type
 `cabal configure  cabal build` and find a complete JS application in your
 dist folder. This would go a long way to make the UHC JS backend more
 usable and as a result, make Haskell a practical language to use for
 client-side programming. In solving this problem, you will have to think
 about how to deal with external Haskell libraries (UHC compiles JS from its
 internal core representation, so storing pre-compiled object files won't
 work in this case) and perhaps external JS libraries as well. You would
 also need to modify Cabal so that it becomes possible to select a specific
 UHC backend in your cabal files. Ideally, you will only need one cabal file
 for an entire web application; for both the front-end and backend.

 I think this would make a nice GSoC project. The scope of the above should
 be about right, but if you would be done way ahead of time, there are
 plenty of relevant related things you could work on (e.g., a UHC
 JS-specific Haskell Platform-like package). If this sounds interesting to
 you, let me know and I can send you some more detailed information about
 the UHC JS backend. As for mentoring, I might be able to help out there,
 but since the above project would revolve more around Cabal and not so much
 around the UHC internals, there might be more suitable mentors out there.


 Jurriën

 [1] http://uu-computerscience.github.com/uhc-js/

 On 8 Mar 2012, at 14:58, Heinrich Apfelmus wrote:

  Chris Smith wrote:
  My first impression on this is that it seems a little vague, but
  possibly promising.
 
  My impression is also that this project proposal is rather vague. The
 general goal Haskell as client-side language for websites is clear and
 worthwhile, but I can't tell from the proposal whether the project will
 succeed or not, or, more importantly, *what* it will succeed at.
 
 
  The way I see it is that a successful GSoC proposal has to embody four
 key points:
 
  1. One specific goal - I want to compile Haskell to JS via UHC's
 backend
  2. in a larger context - as a step towards Haskell as a client-side
 language for websites.
  3. that is accompanied by a successful example - To demonstrate that
 this works, I will write a small Asteroids game with HTML5 and Haskell
  4. and that others can build upon - Moreover, I want to make it really
 easy for others to use the Haskell-JS compilation from cabal.
 
  The last point is extremely important: you don't want to build a hobbled
 prototype that languishes in a dark corner of github, you want to build a
 great software that changes the world by solving an important problem and
 making this solution really easy to use!
 
 
  Alejandro, your proposal mentions several different specific goals, each
 of which can be the basis for a successful GSoC project:
 
  * Make UHC's Haskell-JS compilation easy to use.
  * Design combinators for DOM manipulation in functional style, f.i.
 zippers. Note that this goal does *not* involve running Haskell on the
 client-side, the focus is solely on the design of combinators. This means
 that you'd have to use another example, for instance XML parsing. Of
 course, the idea is that this can be reused when someone else manages to
 run Haskell on the client.
  * Design combinators for remote procedure calling via HTTP/AJAX.
 Again, there is no Haskell running in the browser, the showcase would be
 two Haskell processes that communicate with each other via HTTP/AJAX.
 
  Each of these goals is a tangible improvement on the status quo and
 specific enough to be completed in a single GSoC project.
 
 
  Of course, the one specific goal is not supposed to be a limit, it is
 meant to be a foundation. If there is time remaining, the student is free
 to work on whatever he dreams of. By all means, don't hesitate to reach for
 the sky, but help us climb to the tree top first.
 
 
  Best regards,
  Heinrich Apfelmus
 
  --
  http://apfelmus.nfshost.com
 
 
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe


 

Re: [Haskell-cafe] Summer of Code idea: Haskell Web Toolkit

2012-03-07 Thread Alejandro Serrano Mena
I agree with you that maybe this proposal is vague for a GSoC, but I don't
think that websockets is a good option either, because not all browsers
support them. Indeed, web development has gone a long way without contant
communication with the server and I think Haskell should support this way
of working too.

My idea would rather go on the direction of using stablished Haskell
concepts to web development. Some ideas are:
- use an applicative interface like the one of Yesod for forms validation
and sending
- see the DOM via a Zipper interface, so widgets will anchor themselves
in some point of the tree and change things around them
- use FRP for Canvas interaction
- ...

Actually, thinking which Haskell concepts could behave well with
client-side development is an interesting discussion by its own :)


2012/3/7 Greg Weber g...@gregweber.info

 This is obviously a great concept. However, it may not be appropriate
 for a GSoC. The design space is far too open, and it is not clear if
 anything in that space will end up beating plain old javascript.

 I think my proposal for an awesome websockets library [1] shows that
 this is putting the cart before the horse. For some of the potential
 javascript solutions, websockets is a dependency anyways. Without
 being able to hold open a connection to the server, required server
 interaction will be too slow.
 Yesod has been successful by explicitly avoiding any new radical
 paradigms, but by instead just trying to get the basics of web
 development established correctly. Without websockets, we don't have
 the basics down for fluid client-side interaction.
 The groundwork for this ticket has been laid: it should be easy to
 accomplish with time left over.
 So we are guaranteed a clear win for the community. With the time left
 over, a solution to the javascript problem can be attempted. But there
 is no burden for it to be solved within the summer. Next year the
 landscape will be more mature and we can try to come up with a solid
 proposal for the javscript problem if the community hasn't already
 created a solution.

 [1] http://hackage.haskell.org/trac/summer-of-code/ticket/1607

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


[Haskell-cafe] Summer of Code idea: Haskell Web Toolkit

2012-03-06 Thread Alejandro Serrano Mena
Hi,
I'm really looking forward to helping in the Summer of Code, if Haskell
goes into it this year (something I take for granted :). I would like to
propose an idea for a project, and I'm looking for suggestions about
whether it's good, should be improved or it's just unfeasible.

My idea is to make a client-side Haskell Web Toolkit, in the spirit of
Google Web Toolkit, which would allow to program in Haskell the client part
of a web application, and would complement the web frameworks already
existing for Haskell (such as Yesod and Snap). The point is coming about
with a Haskell-ish way to program applications, to reuse all the existing
knowledge for our beloved language.

I've added more details in a pre-proposal in Google Docs, available in
https://docs.google.com/document/d/1FnTNO9uTobDHRTDXWurKns7vGTjeauw0nRhbtt6vavs/edit
Tell me if you prefer to see it in other format, but I didn't want to
generate a bigger e-mail.

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


Re: [Haskell-cafe] Summer of Code idea: Haskell Web Toolkit

2012-03-06 Thread Alejandro Serrano Mena
My idea would be reusing some of the already-available tools for compiling
Haskell to JS (for example, UHC), and develop with any of them a complete
library for client-side scripting; rather that redevelop a way to compile
Haskell to JS.

I think it's really a pity not being able to use things like what Yesod
provides in a client-side context. And both sides would benefit: they can
share common code for datatypes (as it's done in Google Web Toolkit), and
autogenerate some code for sending or receiving AJAX requests, for example.


2012/3/6 Michael Snoyman mich...@snoyman.com

 On Tue, Mar 6, 2012 at 11:40 PM, Alejandro Serrano Mena
 trup...@gmail.com wrote:
  Hi,
  I'm really looking forward to helping in the Summer of Code, if Haskell
 goes
  into it this year (something I take for granted :). I would like to
 propose
  an idea for a project, and I'm looking for suggestions about whether it's
  good, should be improved or it's just unfeasible.
 
  My idea is to make a client-side Haskell Web Toolkit, in the spirit of
  Google Web Toolkit, which would allow to program in Haskell the client
 part
  of a web application, and would complement the web frameworks already
  existing for Haskell (such as Yesod and Snap). The point is coming about
  with a Haskell-ish way to program applications, to reuse all the existing
  knowledge for our beloved language.
 
  I've added more details in a pre-proposal in Google Docs, available
  in
 https://docs.google.com/document/d/1FnTNO9uTobDHRTDXWurKns7vGTjeauw0nRhbtt6vavs/edit
  Tell me if you prefer to see it in other format, but I didn't want to
  generate a bigger e-mail.
 
  Thanks in advance.

 I definitely think the idea has merit. In general I'm wary of
 solutions which try to compile down to Javascript[1], and I'm not sure
 if actually providing a full Haskell-to-JS approach is a good idea.
 Another possibility might be a DSL/combinator library for generating
 JS. Though at this point, I wouldn't rule out either approach.

 Yesod is currently wrapping up its 1.0 release (almost certainly
 out-the-door by the end of April), and after that our main focus is
 intended to be client-side integration, so we would certainly be happy
 to discuss design ideas and collaborate in general.

 Michael

 [1] I say compile down to to mean nontrivial changes, as opposed to
 something like Coffeescript, which is a fairly simple conversion.

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


Re: [Haskell-cafe] [haskell-cafe] Some reflections on Haskell

2012-02-14 Thread Alejandro Serrano Mena
Hi,

2012/2/14 Doug McIlroy d...@cs.dartmouth.edu

 Kevin Jardine notices the full Haskell ecosystem ... is huge, and
 laments the absence of a sophisticated IDE to help manage it.
 Being a small-code type, I don't personally enjoy IDE's, which
 are undeniably useful in big projects, at the cost of a whole lot
 more to learn about programmering in addition to programming.


There are now several IDEs (or development environments) that you may use
for Haskell programming: I personally work on EclipseFP (so the environment
is quite similar to Java), but there is also Leksah. I've seen people
making incredible things using Emacs and the Haskell modes, so I think
there is now quite nice support for Haskell programming.
Apart from that, Haskell Platform and cabal makes it easy to use Haskell
(at least as easy as PHP if you are using any of the LAMP packages in
Windows, or Perl or Python).

(Disclaimer: I'm currently one of the developers of EclipseFP)


 Nevertheless, I share Jardine's concern about the central problem.
 It is hard to find one's way in this ecosystem.  It needn't be,
 as Java illustrates.  To my mind Java's great contribution to the
 world is its library index--light years ahead of typical
 documentation one finds at haskell.org, which lacks the guiding
 hand of a flesh-and-blood librarian.  In this matter, it
 seems, industrial curation can achieve clarity more easily than
 open source.


I disagree with that. For me, one of the best things about Haskell
community is Hackage, where I can actually find and browse package
documentation in a centralized way. In these days, Maven or Ivy (for
automatically resolving and getting Java dependencies) are seen as great
tools for Java ecosystem, and in Haskell we have that, with an even easier
way to add packages and new versions to the index!
Indeed, I find that Hackage enables a workflow not available in any other
programming language: say you don't find a feature in Hackage libraries.
Well, you can be pretty sure that no one has programmed a library for your
task (opposed to Java or .NET, where it may be a commercial library, and be
found somewhere random in the internet). Once you program it, you can
upload it to Hackage and share easily with the rest of the community.
Finally, even though we may argue about the point that core Java
libraries have better documentation that core Haskell libraries (although
libraries such as container even give complexity bounds to their
operations), I find better Haskell documentation for other different
resources: see the free-available Learn you a Haskell, Real World
Haskell (just to name some tutorials), the Snap and Yesod documentation
(as opposed to the documentation of other web frameworks in the wild)...
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Module name space question

2011-12-12 Thread Alejandro Serrano Mena
You can try the Haskell Browser in the Eclipse plug-in.

2011/12/12 wren ng thornton w...@freegeek.org

 On 12/12/11 9:32 AM, Ryan Newton wrote:

 I don't know why Hoogle didn't find one of the packages.  I've often
 wondered about this related question:

* Is there a place to browse the union of all namespaces in all hackage
 packages?


 There is, and it's awesome:


 http://folk.ntnu.no/hammar/**explore-hackage/http://folk.ntnu.no/hammar/explore-hackage/

 Though it can be a bit slow to load, so try not to hammer the server too
 hard :)

 --
 Live well,
 ~wren


 __**_
 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


Re: [Haskell-cafe] Poll: Do you want a mascot?

2011-11-23 Thread Alejandro Serrano Mena
Yes

2011/11/23 heathmatlock heathmatl...@gmail.com

 On Wed, Nov 23, 2011 at 1:40 PM, Alexander Bernauer 
 alex-hask...@copton.net wrote:

 Yes

 PS: Why not using Doodle for the poll?


 Email is an easy way to make sure nobody votes twice.


 --
 Heath Matlock
 +1 256 274 4225

 ___
 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] A Mascot

2011-11-22 Thread Alejandro Serrano Mena
I really love the idea of Haskell having a mascot, and Da the Lamb seems a
perfect one to me.

2011/11/22 heathmatlock heathmatl...@gmail.com

 I goofed on a few images, but I'm a bit tired to correct them at the
 moment. Also, I'll upload higher res images another time, they don't look
 terrible up close.


 On Tue, Nov 22, 2011 at 3:52 PM, heathmatlock heathmatl...@gmail.comwrote:

 Wasn't planning on it, but I saw some emails on the topic, so I worked on
 what I presented earlier:

 http://imgur.com/a/yIUOA

 A favicon is attached as well, it probably could use more work.




 --
 Heath Matlock
 +1 256 274 4225

 ___
 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] Fwd: problem with cabal install MissingH-1.1.1.0

2011-09-23 Thread Alejandro Serrano Mena
There are for sure people who know better Haskell on Mac than me.
When I made tests for EclipseFP, I just used the latest Haskell Platform
release containing GHC 7.0.3 and it worked fine. Maybe the best thing you
can do is start all over again using Haskell platform, if you don't need any
new feature in GHC 7.2
Other option is compiling the development version of scion-class-browser
(you can find it in https://github.com/serras/scion-class-browser) which
drops the dependency on MissingH, and tell EclipseFP to use that version.


2011/9/23 Mariano Cortesi mcort...@gmail.com

 Hey!

 Thanks to all for the answers... i didn't know about ghc 7.2.

 I uninstalled ghc and reinstalled using homebrew (mac package manager).
 Now I have:

 The Glorious Glasgow Haskell Compilation System, version 7.0.4

 cabal is:

 /usr/bin ➜ cabal --version
 cabal-install version 0.10.2
 using version 1.10.2.0 of the Cabal library

 And now, I was able to install MissingH, but still can't make EclipseFP
 work correctly :S

 When i start EclipseFP, it tries to build the scion-browser, but it fails
 inmediately with a message from cabal:

 cabal: The program ghc version =6.4 is required but it could not be found.

 Google wasn't much help. Is anybody using EclipseFP? I've installed version
 2.1 in eclipse indigo. I'm a regular eclipse user, but with haskell i'm
 lost.


 Best,

 Mariano

 *
 *

 ___
 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] ANN: EclipseFP 2.1.0 released

2011-09-03 Thread Alejandro Serrano Mena
Sorry, there was an error in the installation instructions. You need to
download a version of Eclipse with Java support (Eclipse for Java
developers, Eclipse for Java EE developers or Eclipse Classic).

If you find any other error, you can report it in the mailing list at
http://sourceforge.net/mailarchive/forum.php?forum_name=eclipsefp-develop

2011/9/3 Andreas Baldeau andr...@baldeau.net

 Hi there,

 I wanted to give the 2.1.0 version a try, so I followed the install
 instructions on the website and downloaded one of the available Eclipse
 packages (I chose Eclipse IDE for JavaScript Web Developers). Installing
 EclipseFP then gave me the following error:

  Cannot complete the install because one or more required items could not
 be found.
  Software currently installed: FP: Haskell support for Eclipse 2.1.0
 (net.sf.eclipsefp.haskell.feature.group 2.1.0)
  Missing requirement: Haskell Plug-in Debug Core 2.1.0
 (net.sf.eclipsefp.haskell.debug.core 2.1.0) requires 'bundle
 org.eclipse.jdt.junit 3.3.0' but it could not be found
  Cannot satisfy dependency:
  From: Haskell Plug-in Debug UI 2.1.0 (net.sf.eclipsefp.haskell.debug.ui
 2.1.0)
  To: bundle net.sf.eclipsefp.haskell.debug.core 0.0.0
  Cannot satisfy dependency:
  From: FP: Haskell support for Eclipse 2.1.0
 (net.sf.eclipsefp.haskell.feature.group 2.1.0)
  To: net.sf.eclipsefp.haskell.debug.ui 2.0.3

 As I couldn't find a hint where to report bugs, I thought I might simply
 reply to your announcement.

 Andreas

 ___
 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] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Alejandro Serrano Mena
I'll give my two cents about some design I've been thinking about. Instead
of trying to derive all instances automatically, the programmer should
explicitly tell them (so the problems about conflicting implementations
would be minimised). I attach a piece of code of what I think could be done:

instance Functor a = Monad a where  -- notice the reversed =
  fmap = ...

from Monad MyMonad derive Functor MyMonad

With the from_derive_ clause, we are telling exactly from which =
declaration to pull the definition from. The part of from should have
already been written or derived, so we know exactly which instance the user
is speaking about.

More refinements to the syntax could be done, for example if we have:

instance Functor a = Applicative a where
  fmap = ..

instance Applicative a = Monad a where
  pure = ...
  (*) = ...

Then, writing from Monad MyMonad derive Functor MyMonad would go through
the entire tree of reverse instance declarations and create instances for
Applicative, and from that a Functor one (of course, this should fail if we
have more than one path, then the user should write the path explicitly as
from Monad M derive Applicative M; from Applicative M derive Functor M).
But it has the advantage of allowing later addition of classes in the path,
that would be derived when recompiling the code that uses it.

2011/7/25 Ryan Ingram ryani.s...@gmail.com

 My guess is that nobody has put forward a clear enough design that solves
 all the problems.  In particular, orphan instances are tricky.

 Here's an example:

 module Prelude where

 class (Functor m, Applicative m) = Monad m where
 return :: a - m a
 (=) :: m a - (a - m b) - m b
 () :: m a - m b - m b
 a  b = a = const b

 pure = return
 (*) = ap
 fmap = liftM

 module X where
 data X a = ...

 module Y where
 instance Functor X where fmap = ...

 module Z where

 instance Monad X where
 return = ...
 (=) = ...
 -- default implementation of fmap brought in from Monad definition

 module Main where
 import X
 import Z

 foo :: X Int
 foo = ...

 bar :: X Int
 bar = fmap (+1) foo  -- which implementation of fmap is used?  The one from
 Y?


   -- ryan



 On Sun, Jul 24, 2011 at 8:55 PM, Ivan Lazar Miljenovic 
 ivan.miljeno...@gmail.com wrote:

 On 25 July 2011 13:50, Sebastien Zany sebast...@chaoticresearch.com
 wrote:
  I was thinking the reverse. We can already give default implementations
 of class operations that can be overridden by giving them explicitly when we
 declare instances, so why shouldn't we be able to give default
 implementations of operations of more general classes, which could be
 overridden by a separate instance declaration for these?
 
  Then I could say something like a monad is also automatically a functor
 with fmap by default given by... and if I wanted to give a more efficient
 fmap for a particular monad I would just instantiate it as a functor
 explicitly.

 I believe this has been proposed before, but a major problem is that
 you cannot do such overriding.

 --
 Ivan Lazar Miljenovic
 ivan.miljeno...@gmail.com
 IvanMiljenovic.wordpress.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] Text.CSV questions

2011-06-20 Thread Alejandro Serrano Mena
Maybe you can directly distinguish if the parser returned an error (Left) or
not (Right), instead of using lefts and rights:

import Text.CSV
import Data.Either
import System
import Data.List

main = do
 [inpFileName] - getArgs
 putStrLn (Parsing ++inpFileName++...)
 result - parseCSVFromFile inpFileName
 case result of
   Left error - do print Parse error: 
 print error
   Right csv - print csvL
 putStrLn All done.

2011/6/17 Dmitri O.Kondratiev doko...@gmail.com



 On Fri, Jun 17, 2011 at 1:04 PM, Vincent Hanquez t...@snarc.org wrote:

 On 06/17/2011 10:00 AM, Dmitri O.Kondratiev wrote:

 Hi,
 I try to parse csv file with Text.CSV, like this:

 import Text.CSV
 import System

 main = do
 [inpFileName] - getArgs
 putStrLn (Parsing ++inpFileName++...)
 let result = parseCSVFromFile inpFileName
 print result


 === As a result I get:

  No instance for (Show
(IO (Either Text.Parsec.Error.ParseError CSV)))
   arising from a use of `print'
  Possible fix:
   add an instance declaration for
   (Show (IO (Either Text.Parsec.Error.ParseError CSV)))

 === Question:
 How to add a Show instance for (IO (Either Text.Parsec.Error.ParseError
 CSV))) ?

 Hi Dmitri,

 you don't add a show instance for IO, but you unwrap the IO Monad first
 and then show the result.

 let result = parseCSVFromFile inpFileName

 should be:

 result - parseCSVFromFile inpFileName

 --
 Vincent


 Thanks everybody!  This is how I solved it:

 import Text.CSV
 import Data.Either
 import System
 import Data.List


 main = do
  [inpFileName] - getArgs
  putStrLn (Parsing ++inpFileName++...)
  result - parseCSVFromFile inpFileName
  let errors = lefts [result]
  let csvL = rights [result]
  print CSV list
  print csvL
  print Errors
  print errors
  putStrLn All done.


 ___
 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] Problem with linker

2011-06-04 Thread Alejandro Serrano Mena
No, it does not report any problem.

2011/6/4 Clint Moore cl...@ivy.io


 On Sat, Jun 04, 2011 at 01:17:03AM +0200, Alejandro Serrano Mena wrote:
  Hi,
  I'm trying to use Hoogle as a library in my Summer of Code project. But
 when
  I try to compile using Cabal, I get the following error:
 
  Linking dist/build/scion-browser/scion-browser ...
 
 /home/serras/.cabal/lib/hoogle-4.2.4/ghc-7.0.2/libHShoogle-4.2.4.a(Serialise.o):
  In function `s1ePR_info':
  (.text+0x2015): undefined reference to
  `hooglezm4zi2zi4_Pathszuhoogle_version1_closure'
 
 /home/serras/.cabal/lib/hoogle-4.2.4/ghc-7.0.2/libHShoogle-4.2.4.a(Serialise.o):
  In function `s1f8a_info':
  (.text+0x338f): undefined reference to
  `__stginit_hooglezm4zi2zi4_Pathszuhoogle_'
 
  I've been looking for some information and it seems to be related with
 the
  fact that Hoogle first builds a library and then build an executable
 using
  the library, but all files get recompiled in that second pass.
 
  Is there any way to workaround this problem?

 Does 'ghc-pkg check' report any problems?


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


Re: [Haskell-cafe] Problem with linker

2011-06-04 Thread Alejandro Serrano Mena
I'm using the last Haskell Platform available in Arch Linux, with GHC 7.0.2
and Cabal 1.10.1.0 (the last one).

The problem is not installing Hoogle, because it builds and works correctly,
but linking with the library Hoogle provides.

2011/6/4 Rogan Creswick cresw...@gmail.com

 On Fri, Jun 3, 2011 at 4:17 PM, Alejandro Serrano Mena
 trup...@gmail.com wrote:
 
  I've been looking for some information and it seems to be related with
 the
  fact that Hoogle first builds a library and then build an executable
 using
  the library, but all files get recompiled in that second pass.
  Is there any way to workaround this problem?
 

 Upgrading Cabal / cabal-install is a good place to start, if you're
 not already using the 0.10's.  I also suggest using cabal-dev, since
 issues like this can be caused by combinations of dependencies that
 conflict.

 There's a good chance that you just have a weird mix of compiled
 libraries that don't all work together, and cabal isn't able/willing
 to rebuild everything necessary to make all the things in your user
 package db work together.

 I very recently installed Hoogle locally, on a fresh system, so I'm
 fairly confident it's still possible without too many headaches :).

 --Rogan

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


[Haskell-cafe] Problem with linker

2011-06-03 Thread Alejandro Serrano Mena
Hi,
I'm trying to use Hoogle as a library in my Summer of Code project. But when
I try to compile using Cabal, I get the following error:

Linking dist/build/scion-browser/scion-browser ...
/home/serras/.cabal/lib/hoogle-4.2.4/ghc-7.0.2/libHShoogle-4.2.4.a(Serialise.o):
In function `s1ePR_info':
(.text+0x2015): undefined reference to
`hooglezm4zi2zi4_Pathszuhoogle_version1_closure'
/home/serras/.cabal/lib/hoogle-4.2.4/ghc-7.0.2/libHShoogle-4.2.4.a(Serialise.o):
In function `s1f8a_info':
(.text+0x338f): undefined reference to
`__stginit_hooglezm4zi2zi4_Pathszuhoogle_'

I've been looking for some information and it seems to be related with the
fact that Hoogle first builds a library and then build an executable using
the library, but all files get recompiled in that second pass.

Is there any way to workaround this problem?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe