Re: [Haskell-cafe] Compiler stops at SpecConstr optimization

2013-09-01 Thread Daniel Díaz Casanueva
Yes, that GHC ticket shows that this problem is well known.

Thank you.


On Fri, Aug 30, 2013 at 2:19 AM, Ben Lippmeier b...@ouroborus.net wrote:


 On 30/08/2013, at 2:38 AM, Daniel Díaz Casanueva wrote:

  While hacking in one of my projects, one of my modules stopped to
 compile for apparently no reason. The compiler just freezes (like if it
 where in an infinite loop) while trying to compile that particular module.
 Since I had this problem I have been trying to reduce the problem as much
 as I could, and I came out with this small piece of code:
 
   module Blah (foo) where
 
   import Data.Vector (Vector)
   import qualified Data.Vector as V
 
   foo :: (a - a) - Vector a - Vector a
   foo f = V.fromList . V.foldl (\xs x - f x : xs) []

 Probably an instance of this one:

 http://ghc.haskell.org/trac/ghc/ticket/5550

 Ben.


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


[Haskell-cafe] Compiler stops at SpecConstr optimization

2013-08-29 Thread Daniel Díaz Casanueva
Hello.

While hacking in one of my projects, one of my modules stopped to compile
for apparently no reason. The compiler just freezes (like if it where in an
infinite loop) while trying to compile that particular module. Since I had
this problem I have been trying to reduce the problem as much as I could,
and I came out with this small piece of code:

 module Blah (foo) where

 import Data.Vector (Vector)
 import qualified Data.Vector as V

 foo :: (a - a) - Vector a - Vector a
 foo f = V.fromList . V.foldl (\xs x - f x : xs) []

The module I am importing comes from package vector-0.10.0.1. The compiler
I am using is ghc-7.6.3. The problem arises when compiling using the
following flags:

ghc Blah.hs -O1 -fspec-constr

If I compile it verbosely (with -v), I can see that the compiler stops in
the SpecConstr optimization step. I have tried to reduce the -O1 flag to a
particular set of flags, but I didn't manage yet to find the complete set
of flags that -O1 translates to (optLevelFlags [1] seems to give not enough
information).

Since this problem can be OS-dependent, my system is Debian 7 and I didn't
try yet to reproduce my problem in other systems (mainly because I don't
have access to other systems at the moment).

I am posting this here to, with the help of the Haskell Community, check
first if this is indeed a bug and, in such case, to find out where that bug
comes from (GHC, vector library, something else?). Then, if necessary, I
would write a bug report where appropriate.

Thank you,
Daniel Díaz.

-- References

[1] -
https://github.com/ghc/ghc/blob/ghc-7.6.3-release/compiler/main/DynFlags.hs#L2266
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: processing-1.2.0.0. Graphic web applications with processing.js.

2013-08-18 Thread Daniel Díaz Casanueva
Hello readers of Haskell-Cafe.

Yesterday I uploaded a new version of the processing library [1].

== What is this library for? ==

The library is oriented to create graphic applications that run in a web
browser, with no need of running a server. It provides the user with a set
of functions and combinators that can be used to create an abstract piece
code. This code is rendered to the processing language syntax. Once the
code is uploaded, using processing.js [2], the output code is runnable from
any browser with JavaScript support. To quickly give you a taste of the
library, look at this animation, created with a simple recursive function:

http://daniel-diaz.github.io/projects/processing/mill.html

The code is here:

https://github.com/Daniel-Diaz/processing/blob/master/examples/mill.hs

== What's new? ==

After a couple of weeks working hard to have this library properly working,
I think it have reached a point of reasonable usability. As a proof, I have
written a simplified version of the Pac-Man game [3]. However, although I
have implemented some code optimizations, it seems that the game still does
not run smoothly in every web browser. I will definitely keep trying to
improve the performance of the code generated by the library.

I encourage you to try the library if you are interested, but keep in mind
that it is still in an early stage, and may contain bugs, lack some
important features, have an incomplete documentation or suffer from API
changes.

== References ==

[1] Library at Hackage -
http://hackage.haskell.org/package/processing-1.2.0.0
[2] Processing.js - http://processingjs.org
[3] Pac-Man game -
http://daniel-diaz.github.io/projects/processing/pacman.html
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Does exist something like data-files in Cabal, which works at compile time?

2013-08-16 Thread Daniel Díaz Casanueva
What I have always done to solve this is to create a custom Setup.hs.
Something like:

Setup.hs
-
import Distribution.Simple

main :: IO ()
main = doThisBeforeInstall  defaultMain
-

Then you specify in your .cabal file that the Build-Type is Custom.

Best regards,
Daniel Díaz.


On Fri, Aug 16, 2013 at 11:58 AM, Alfredo Di Napoli 
alfredo.dinap...@gmail.com wrote:

 Hello guys,

 I'm pretty sure the answer is no, but I was hoping to get some extra
 insight / best practices. The problem can be summarised by this SO question
 (not the OP, but I have the same problem):


 http://stackoverflow.com/questions/15731170/cabal-how-to-add-text-file-as-a-build-dependency

 As someone states, data-files in for run-time, whereas I need to tell
 cabal please copy these files in place before trying to compile, so at
 compile-time.

 Does something similar exist?

 I think the best solution, unless someone prove me wrong, is to create a
 small startup script which copies the files for me (I *think* yesod is
 using something similar, namely a script called EmbeddedFiles.hs) and then
 triggers cabal install the usual way. Can you come up with a better way?

 Thanks in advance!

 Alfredo

 ___
 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] Automatically test different versions of single dependency

2013-07-04 Thread Daniel Díaz Casanueva
Hello everyone.

I would like to check what dependencies is one of my packages compatible
with. For example, say I have a package called foo that depends on
package bar. Most likely, foo does not build with each version of
bar. What I want to do is try to build foo with each single version of
bar (not manually).

What is the best approach to this?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Automatically test different versions of single dependency

2013-07-04 Thread Daniel Díaz Casanueva
Hello, Alp.

Thank you for your response. Currently, I am extracting the information
from the 00-index.tar.gz, and planning to use cabal-dev for the builds.
Using the cabal tool directly looks like a very bad idea to me. I am still
interested in knowing if there is some related job already done, or any
other clever ideas that I didn't manage to think of. However, this looks
like the best approach right now.

Thank you,
Daniel Díaz.


On Thu, Jul 4, 2013 at 2:36 PM, Alp Mestanogullari alpmes...@gmail.comwrote:

 You can just write a bash script that will do:

 cabal install --constraint='bar == v'

 for all the values of 'v' (0.1, 0.2, 1.2.5.1, ...) you are interested in.
 You can be aware of all the existing versions just using the directory
 listing in http://hackage.haskell.org/packages/archive/containers/ (for
 the 'containers' package in this case) or by using cabal-install cleverly
 maybe?

 I just saw 'cabal info containers' gives a list of available versions, up
 to a point... after which it says (and 4 others). So maybe go see how
 'cabal info' does this? But all in all, this should give you enough to work
 out a nice solution.



 On Thu, Jul 4, 2013 at 12:56 PM, Daniel Díaz Casanueva 
 dhelta.d...@gmail.com wrote:

 Hello everyone.

 I would like to check what dependencies is one of my packages compatible
 with. For example, say I have a package called foo that depends on
 package bar. Most likely, foo does not build with each version of
 bar. What I want to do is try to build foo with each single version of
 bar (not manually).

 What is the best approach to this?

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




 --
 Alp Mestanogullari

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


Re: [Haskell-cafe] Custom Setup.hs and Paths module

2013-07-03 Thread Daniel Díaz Casanueva
Hello Erik.

Yes, that solution may work, but seems ad-hoc to me. I would like to see a
way to actually import the Paths module. In the meanwhile, I will be using
your idea. Thank you for the response.

Anybody knows how to hack the Setup.hs so I can use the real Paths module?


On Wed, Jul 3, 2013 at 3:39 AM, Erik de Castro Lopo mle...@mega-nerd.comwrote:

 Daniel Díaz Casanueva wrote:

  Hi everyone.
 
  I am writing a package where I am using the Paths module that cabal
  generates automatically. After adding the Paths module to the
  other-modules section in my cabal file everything worked just fine,
 until
  I wanted to write a custom Setup.hs. This Setup.hs just writes a couple
 of
  files in the system and then calls defaultMain. The thing is that now
  cabal install does not find the Paths module, so the package is broken.

 I ran into the same problem. I ended up fixing it by *not* using the auto
 generated Paths module and instead parsing the cabal file in Setup.hs.

 This is not has horrible as it sounds as I used the Cabal insfrastructure
 to do it. Basically something like this:

 import Distribution.Simple
 import Distribution.PackageDescription
 import Distribution.PackageDescription.Parse (readPackageDescription)
 import Distribution.Verbosity (silent)

 version - fmap (showVersion . pkgVersion . package .
 packageDescription)
 $ readPackageDescription silent my-package.cabal

 and then used that version String to write a trivial 5 line file
 Version.hs.

 HTH,
 Erik
 --
 --
 Erik de Castro Lopo
 http://www.mega-nerd.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] Custom Setup.hs and Paths module

2013-07-02 Thread Daniel Díaz Casanueva
Hi everyone.

I am writing a package where I am using the Paths module that cabal
generates automatically. After adding the Paths module to the
other-modules section in my cabal file everything worked just fine, until
I wanted to write a custom Setup.hs. This Setup.hs just writes a couple of
files in the system and then calls defaultMain. The thing is that now
cabal install does not find the Paths module, so the package is broken.

Any thoughts? I need your help, people!

Thank you,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: HaTeX 3.6. Now with Babel, TikZ and more!

2013-06-25 Thread Daniel Díaz Casanueva
Hello everyone!

It is time for a new release of HaTeX, the Haskell LaTeX library.

http://hackage.haskell.org/package/HaTeX-3.6

== What is HaTeX? ==

HaTeX contains numerous types and functions that will assist you in the
process of creating a LaTeX document within Haskell. You can also include
your manually created LaTeX code in HaTeX, so you can choose the more
convenient tool you want to use for each case.

== What's new in this release? ==

A lot of changes have been made since the last release! The most important
changes are explained in the blog post I just wrote:

http://deltadiaz.blogspot.com.es/2013/06/hatex-36-texy-class-babel-fontenc-tikz.html

However, the new feature I am more excited with is the TikZ script
generator. Using a very intuitive interface, you will be able to generate
high quality graphics for LaTeX documents. It is still far from be
complete, but next releases will fill the gaps that you may find right now.

Just to give you a taste, consider the following code:

 myFigure :: Figure
 myFigure = Scale 2 $ Figures
   [ RectangleFilled (0,0) 1 1
   , Colored Green $ RectangleFilled (-1,1) 1 1
   , Colored Red   $ RectangleFilled ( 0,2) 1 1
   , Colored Blue  $ RectangleFilled ( 1,1) 1 1
 ]

With this simple construction you already have the following picture ready
to be inserted in your LaTeX file output.

http://daniel-diaz.github.com/projects/hatex/tikzsimple.png

In the examples directory contained in the source distribution there is
also an example (tikz.hs) that includes the plotting of a Haskell function
(sine). However, the interface it uses may be less comfortable than the one
shown in the example above.

If you are a HaTeX user, don't miss this update, because it also contains
some very important bug fixes.

Any feedback gladly accepted.

Good luck,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: standalone-haddock-1.0

2013-06-07 Thread Daniel Díaz Casanueva
Hello Roman!

Thank you, this is a great contribution. I found myself several times
modifying the html output by hand in order to do exactly this. Nice!


On Fri, Jun 7, 2013 at 2:15 PM, Roman Cheplyaka r...@ro-che.info wrote:

 I am happy to announce the first release of standalone-haddock.

   http://feuerbach.github.io/standalone-haddock/

 standalone-haddock generates standalone haddock Haskell documentation.

 When you simply run `cabal haddock`, the resulting HTML documentation
 contains
 hyperlinks to other packages on your system. As a result, you cannot
 publish it
 on the internet (well, you can, but the links will be broken).

 standalone-haddock takes several packages for which you want to publish
 documentation. It generates documentation for them with proper links:

 * links to identifiers inside this package set are relative
 * links to identifiers from external packages lead to hackage

 Thus the resulting directory with HTML is relocatable and publishable.

 **TL;DR**: it just works. See the [haskell-suite][] documentation for an
 example
 output.

 [haskell-suite]: http://haskell-suite.github.io/docs

 Usage
 -

 Usage: standalone-haddock [--package-db DB-PATH] -o OUTPUT-PATH
 [PACKAGE-PATH]

 Available options:
   -h,--helpShow this help text
   --package-db DB-PATH Additional package database
   -o OUTPUT-PATH   Directory where html files will be placed

 `PACKAGE-PATH` is the path to the (unpacked) package — i.e. a directory
 with a
 `.cabal` file.

 For example:

 standalone-haddock -o doc haskell-names haskell-packages
 haskell-src-exts hse-cpp cabal/Cabal

 **NOTE**: dependencies of every package need to be already installed in the
 system with documentation (even those dependencies that themselves belong
 to the
 current package set). If they are installed in a non-standard package
 database
 (e.g. if you use sandboxes), use the `--package-db` option.

 Cabal dependency
 

 The program only builds with (unreleased) Cabal 1.17 which you can get from
 [github](https://github.com/haskell/cabal).

 I spent some time trying to make it compatible with Cabal 1.16 (see
 [Cabal-1.16][] branch), but the API seems to have changed too much.

 If you seriously care about this, feel free to send a patch, but it's
 really
 easier just to install Cabal HEAD.

 [Cabal-1.16]:
 https://github.com/feuerbach/standalone-haddock/tree/Cabal-1.16

 Roman

 ___
 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] Fwd: Cabal config file Guide

2013-05-26 Thread Daniel Díaz Casanueva
Thank you, Albert, what you wrote is very useful.

Why the Cabal Guide is lacking this kind of information? Maybe I should
start gathering information in one place myself!

Thank you,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Cabal config file Guide

2013-05-25 Thread Daniel Díaz Casanueva
Hello Cafe!

As you already know, cabal-install is configured in the file config. It
has a lot of fields, but I didn't find a single place where each field is
explained with detail. Most of the options are trivial enough to understand
what they do without previous explanation, but some of them aren't.
Therefore, in order to know what these options do, you have to search info
about that one specifically, when it would be much more convenient to have
all the information together.

So, is there any place like this out there in the web?

Thank you,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Good to find you on LinkedIn

2013-05-15 Thread Daniel Díaz Casanueva
LinkedIn





Daniel Díaz Casanueva requested to add you as a connection on LinkedIn:
  

--

Minh Thu,

I'd like to add you to my professional network on LinkedIn.

- Daniel

Accept invitation from Daniel Díaz Casanueva
http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I790933864_20/3wOtCVFbmdxnSVFbm8JrnpKqlZJrmZzbmNJpjRQnOpBtn9QfmhBt71BoSd1p65Lr6lOfP0OnPgSe3cPej0VdQALl4EOm5kPtSALdz8PcPwNdP0PcP4LrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=falsetok=0mY1dMLBAo4lM1

View profile of Daniel Díaz Casanueva
http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/rso/255311896/LIky/name/22724543_I790933864_20/?hs=falsetok=2n9H_NXUco4lM1
--
You are receiving Invitation emails.


This email was intended for Minh Thu Vo.
Learn why this is included: 
http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=falsetok=0pRQwEVKAo4lM1

(c) 2012, LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.


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


Re: [Haskell-cafe] Good to find you on LinkedIn

2013-05-15 Thread Daniel Díaz Casanueva
My apologies,

I don't know how this e-mail has reached the Haskell-Cafe.

Sincerely,
Daniel Díaz.


On Wed, May 15, 2013 at 11:44 PM, Daniel Díaz Casanueva mem...@linkedin.com
 wrote:

 [image: LinkedIn Logo] http://www.linkedin.com/


  Minh Thu,

  **












   Daniel Díaz Casanueva wants to connect with you on LinkedIn.


 Daniel Díaz Casanueva
Computer Software Professional  View Profile » 
 http://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/rso/255311896/LIky/name/22724543_I790933864_20/eml-comm_invm-b-pro_txt-inv28/?hs=falsetok=3xtaBEOiMo4lM1





  
 Accepthttp://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/blk/I790933864_20/3wOtCVFbmdxnSVFbm8JrnpKqlZJrmZzbmNJpjRQnOpBtn9QfmhBt71BoSd1p65Lr6lOfP0OnPgSe3cPej0VdQALl4EOm5kPtSALdz8PcPwNdP0PcP4LrCBxbOYWrSlI/eml-comm_invm-b-in_ac-inv28/?hs=falsetok=0mY1dMLBAo4lM1

**


  You are receiving Invitation emails. 
 Unsubscribehttps://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/XvIdBwmueHfd6vFMPXXdLaqreCbl5oOSpPTFPU/uns/20008/22724543/jh9ot6gkko1pkl7/haskell-cafe%40haskell%2Eorg/uc6lxc-hgr1egm6-6q/eml-comm_invm-f-unsub-inv28/?hs=falsetok=3-VEVqVyAo4lM1.


 This email was intended for Minh Thu Vo (Core/Server Lead Developer at
 OpenERP). Learn why we included 
 thishttp://www.linkedin.com/e/uc6lxc-hgr1egm6-6q/plh/http%3A%2F%2Fhelp%2Elinkedin%2Ecom%2Fapp%2Fanswers%2Fdetail%2Fa_id%2F4788/-GXI/?hs=falsetok=0pRQwEVKAo4lM1.
 © 2013, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043,
 USA


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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
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 Daniel Díaz Casanueva
You can always write it like this:

listPairs = [ (x,y) | x - [6 .. 499] ,  y - [0 .. 1000] , isProduct x ,
isSqrt y , mod y x == 0 ]

So you have the bounds for x and y, and then the conditions. You then need
to define isProduct and isSqrt with types

isProduct :: Int - Bool
isSqrt :: Int - Bool

Hopefully, these problems will look easier separately.

Well, it's just an idea.

Good luck,
Daniel Díaz.


On Tue, May 14, 2013 at 4:57 PM, John knowledge1...@gmail.com wrote:

 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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
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 Daniel Díaz Casanueva
Well, definitely, isSqrt should be called isSquare.


On Tue, May 14, 2013 at 5:22 PM, Daniel Díaz Casanueva 
dhelta.d...@gmail.com wrote:

 You can always write it like this:

 listPairs = [ (x,y) | x - [6 .. 499] ,  y - [0 .. 1000] , isProduct x ,
 isSqrt y , mod y x == 0 ]

 So you have the bounds for x and y, and then the conditions. You then need
 to define isProduct and isSqrt with types

 isProduct :: Int - Bool
 isSqrt :: Int - Bool

 Hopefully, these problems will look easier separately.

 Well, it's just an idea.

 Good luck,
 Daniel Díaz.


 On Tue, May 14, 2013 at 4:57 PM, John knowledge1...@gmail.com wrote:

 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




 --
 E-mail sent by Daniel Díaz Casanueva

 let f x = x in x




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
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 Daniel Díaz Casanueva
Hi John,


On Tue, May 14, 2013 at 5:41 PM, John knowledge1...@gmail.com wrote:

 Danny Gratzer wrote
  Well you've deleted the portion of the code referring to x and y.
 
  listPairs = [(a*b, y) | y - [0..], a - [0..], b - [0..], (a*b)  5,
  (a*b)  500, (y*y)  1001, mod y (a*b) == 0]
 
  This will still never terminate however.

 oh I see, but as you say it doesn't terminate and I get nothing. Does it
 mean, that the function is wrong in this place?

 Some questions:
 1. Does the order of conditions affect the result at all?
 2. The , means AND or , right? So how do you write OR || instead? E.g
 z-[1..10] OR z-[100..110].
 Ofcourse it doesn't relate to this topic, but I wanted to know it.

 Since I'm a very beginner I think the approach of Daniel is slightly
 complex
 for me to comprehend, right?
 Allthough I tried it, but it says isProduct and isSquer are not in Scope,
 so
 I should define them first in WHERE-Clause right?


Yes. The idea is to reduce a problem to simpler subproblems. It is a common
practice while programming, and often will make your code clearer. Where do
you find the difficulty? The (incomplete) solution I wrote was:

 [ (x,y) | x - [6 .. 499] ,  y - [0 .. 1000] , isProduct x , isSquare y ,
mod y x == 0 ]

which you can read as:

*The list of the pairs of numbers x and y, where x belongs to {6, ... ,
499}, y belongs to {0, ... , 1000}, x is a product of two numbers, y is the
square of a number and y MOD x is 0.*

These look like the conditions you asked for. So you can say that you
solved the problem of generating the list, if you know how to decide if a
number is a product or a square in the first place. You can define these
two functions separately.

isProduct :: Int - Bool
isProduct n = ...

isSquare :: Int - Bool
isSquare n = ...

The question of if a number is a product or not is equivalent to the
question of checking if a number is prime or not. Indeed, If it is prime,
it is not a product of two natural numbers (I am, of course, guessing that
you don't want ones in the product). If it is NOT prime, then you can
factor the number.

To solve the isSquare problem, you can just check if it coincides with
the square of any number below the square root of the number in question.

I think you don't want an explicit solution, but some hints, so you can
explore the problem deeper and learn from it.

I must also note, as other people have already done, that this questions
fits in better in the Haskell-Beginners mailing list.

http://www.haskell.org/mailman/listinfo/beginners

I hope this works for you,
Daniel Díaz.



 Thanks again to all




 --
 View this message in context:
 http://haskell.1045720.n5.nabble.com/list-comprehension-doesn-t-work-tp5730158p5730167.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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Building the Haskell Platform in Linux

2013-04-14 Thread Daniel Díaz Casanueva
Hello Albert!

Oh! I didn't find that one when searching for info! That would have helped
me a lot!

By the way, a random question, what's the memory of the computer you used
to build the Platform?


On Sun, Apr 14, 2013 at 6:54 PM, Albert Y. C. Lai tre...@vex.net wrote:

 On 13-04-13 12:19 AM, Daniel Díaz Casanueva wrote:

 Hi cafe!

 Probably you all know how to do this, but I myself found confused when
 building the Haskell Platform in Linux for my first time. I was using
 Linux for my first time too! The first problem I encountered was to
 decide what linux packages install to make the ./configure successful in
 both GHC binary distribution and the Haskell Platform. So I collected
 the names of the minimum set of packages that you need to have installed
 before starting with GHC and the Platform in a small blog post:

 http://deltadiaz.blogspot.com/**2013/04/haskell-platform-from-**
 source-in-linux.htmlhttp://deltadiaz.blogspot.com/2013/04/haskell-platform-from-source-in-linux.html


 Shameless plug: also my
 http://www.vex.net/~trebla/**haskell/haskell-platform.xhtmlhttp://www.vex.net/~trebla/haskell/haskell-platform.xhtml
 and it will be yet updated again next version.


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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Announcement] Sparse matrix Conjugate Gradient Solver

2013-04-14 Thread Daniel Díaz Casanueva
Nice! I will look at your implementation to see if I can learn something
from this. :)


On Sun, Apr 14, 2013 at 9:59 PM, Levent Erkok erk...@gmail.com wrote:

 I'm happy to announce the first release of conjugateGradient, implementing
 the Conjugate Gradient algorithm for solving linear systems of equations
 over sparse matrices:

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

 The conjugate gradient algorithm only applies to the cases when the input
 matrix is symmetric and positive definite. See:
 http://en.wikipedia.org/wiki/Conjugate_gradient_method

 The advantage of this method is that it can handle really large sparse
 systems quite well, when other direct methods (such as LU decomposition)
 are just not practical due to algorithmic complexity. Such large and sparse
 systems naturally arise in engineering applications, such as in ASIC
 placement algorithms and when solving partial differential equations.

 Bug reports, feedback, and improvements are always welcome.

 -Levent.

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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] NaN as Integer value

2013-04-13 Thread Daniel Díaz Casanueva
You can always use the Maybe type as a follows:

intDiv :: Integer - Integer - Maybe Integer
intDiv _ 0 = Nothing
intDiv n m = Just (div n m)

This allows you to pattern match results of divisions:

example :: Integer - Integer - Maybe Integer
example n m =
 case intDiv 4 n of
  Nothing - Nothing
  Just n' -
case intDiv 5 m of
  Nothing - Nothing
  Just m' - Just (n' + m')

Or even better using the do notation:

example2 :: Integer - Integer - Maybe Integer
example2 n m = do
n' - intDiv 4 n
m' - intDiv 5 m
return (n' + m')

Note that example and example2 both do the same thing.

I think this is cleaner solution add NaN as a value to the Integer type.

Good luck,
Daniel Díaz.


On Sat, Apr 13, 2013 at 12:16 PM, Алексей Егоров elect...@list.ru wrote:

 Hello haskellers,

 is there a reason why Integer doesn't have 'NaN' as value?
 I think it would be very convenient to be able to handle (1 `div` 0) as
 regular NaN value and not as exception.

 Thanks.

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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Building the Haskell Platform in Linux

2013-04-12 Thread Daniel Díaz Casanueva
Hi cafe!

Probably you all know how to do this, but I myself found confused when
building the Haskell Platform in Linux for my first time. I was using Linux
for my first time too! The first problem I encountered was to decide what
linux packages install to make the ./configure successful in both GHC
binary distribution and the Haskell Platform. So I collected the names of
the minimum set of packages that you need to have installed before starting
with GHC and the Platform in a small blog post:

http://deltadiaz.blogspot.com/2013/04/haskell-platform-from-source-in-linux.html

If I would have to start all over again, forgetting what I have learned so
far, I would fine this list very useful! This thought is what brought me
here to make it public. Who knows, maybe I am saving somebody of some
google searches and trials and errors.

With my best intentions,
Daniel Díaz.

-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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

2013-04-10 Thread Daniel Díaz Casanueva
Hi Alejandro!

It would be great if Spain would have a Haskell Group in the capital city.
I am from Spain and I always begged for something like this. Unfortunately,
I find myself in the United States and unable to help. But if, for any
circumstances, I end up in Madrid, I'll be there to support this.

Saludos de un malagueño,
Daniel Díaz.


On Wed, Apr 10, 2013 at 3:50 AM, Alejandro Serrano Mena
trup...@gmail.comwrote:

 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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: HaTeX-3.5 - New version of the LaTeX library

2013-03-18 Thread Daniel Díaz Casanueva
Hi readers!

A new version of HaTeX has just been released. More math symbols and
utilities and a new attoparsec-based parser. This new version also includes
a new matrix renderer.

A summary of the changes:

http://deltadiaz.blogspot.com/2013/03/hatex-35.html

The package in Hackage:

http://hackage.haskell.org/package/HaTeX-3.5

For those who don't know, HaTeX is a combinator library for LaTeX code.
Read more in the manual:

https://github.com/downloads/Daniel-Diaz/HaTeX-Guide/HaTeX-Guide.pdf

I recommend to HaTeX users to upgrade to this new version.

Good luck,
Daniel Díaz.

-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Some aggregation of Haskell content

2013-02-10 Thread Daniel Díaz Casanueva
I'm totally with this. Also, it is exhausting to check in so many places to
see what's going on. I have been looking for this for a while.


On Sun, Feb 10, 2013 at 10:41 AM, Christopher Done chrisd...@gmail.comwrote:

 Is there a page somewhere that aggregates all of Haskell's community
 output into one place?

 As a consumer of Haskell content I neither have the time nor inclination
 to follow haskell-cafe and other various mailing lists, the reddits, the
 google+ community, planet haskell, hackage releases, twitter, youtube and
 whatever other submission places I haven't heard of.

 I made this page for the Lojban community some years ago:
 http://jbotcan.org/hub/

 Lojban doesn't have much community activity (tho this doesn't include
 mailing list posts), but Haskell's community is much larger and more
 active, it would be far more useful.

 I may write such a page for Haskell content, if not for the community then
 at least for myself, as I keep missing out on cool things because I didn't
 happen to check out that particular medium of exchange. For example, even
 this message will be lost on a thousand people who doesn't follow the
 mailing list but maybe follows G+ or reddit.

 Kind of like a Haskell Weekly news, except more like Haskell news right
 now or in some adjustable time frame. And the option to toggle between
 chronological order or categorized.

 Ciao!

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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Sequence and replicateM

2013-01-25 Thread Daniel Díaz Casanueva
Yes, you're right about the type context. I always forget that Functor is
not a superclass of Monad. Anyway, the `fmap` can be done only with `Monad`
in the context.

About the list fusion, I'm compiling with optimizations enabled (-O2), but
I do not know how it works with fusions. Is it the optimization omitting
the step of creating the list? How can I know it with certainty?


On Fri, Jan 25, 2013 at 7:23 AM, Thomas Horstmeyer 
horst...@mathematik.uni-marburg.de wrote:

 Hi,

 isn't the correct type context for f the following?

 f :: (Functor m, Monad m) = Int - m a - m (Seq a)

 So your f really is a kind of specialization of g.

 Could the reason for f performing better be list fusion? Anything
 happening inside Control.Monad.replicateM should be subject to it.

 Cheers,
 Thomas


 Am 24.01.2013 15:31, schrieb Daniel Díaz Casanueva:

 Hi Cafe,

 I was coding this morning when I suddenly found something that surprised
 me. It's been a short time since I am really caring about the
 performance of my programs. Before, I was just caring about their
 correctness. So I am trying different things and profiling to see
 differences. One difference I have found surprising is that the function
 f is MUCH faster and less space consuming than the function g:

 import Control.Monad
 import qualified Data.Sequence as Seq

 type Seq = Seq.Seq

 f :: Monad m = Int - m a - m (Seq a)
 f n = fmap Seq.fromList . replicateM n

 g :: Monad m = Int - m a - m (Seq a)
 g = Seq.replicateM

 Maybe is just in my test case, where the Int argument is big and the
 monadic action short, but it looks to me that Data.Sequence.replicateM
 can be faster than it is right now.

 Regards,
 Daniel Díaz.

 --
 E-mail sent by Daniel Díaz Casanueva

 let f x = x in x


 __**_
 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-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Data.Sequence and replicateM

2013-01-24 Thread Daniel Díaz Casanueva
Hi Cafe,

I was coding this morning when I suddenly found something that surprised
me. It's been a short time since I am really caring about the performance
of my programs. Before, I was just caring about their correctness. So I am
trying different things and profiling to see differences. One difference I
have found surprising is that the function f is MUCH faster and less space
consuming than the function g:

import Control.Monad
import qualified Data.Sequence as Seq

type Seq = Seq.Seq

f :: Monad m = Int - m a - m (Seq a)
f n = fmap Seq.fromList . replicateM n

g :: Monad m = Int - m a - m (Seq a)
g = Seq.replicateM

Maybe is just in my test case, where the Int argument is big and the
monadic action short, but it looks to me that Data.Sequence.replicateM can
be faster than it is right now.

Regards,
Daniel Díaz.

-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Data.Sequence and replicateM

2013-01-24 Thread Daniel Díaz Casanueva
Good point. However, I forced the result to evaluate using `deepseq` and I
still got similar results.


On Thu, Jan 24, 2013 at 11:41 AM, Gershom Bazerman gersh...@gmail.comwrote:

  On 1/24/13 9:31 AM, Daniel Díaz Casanueva wrote:


  import Control.Monad
  import qualified Data.Sequence as Seq

  type Seq = Seq.Seq

  f :: Monad m = Int - m a - m (Seq a)
 f n = fmap Seq.fromList . replicateM n

  g :: Monad m = Int - m a - m (Seq a)
  g = Seq.replicateM

  Maybe is just in my test case, where the Int argument is big and the
 monadic action short, but it looks to me that Data.Sequence.replicateM can
 be faster than it is right now.


 Are you forcing the full sequence in both cases? In the former case,
 you'll get all the actions, but have a thunk containing the result of
 Seq.fromList. In the latter, you're performing the actions as you build the
 sequence, so the resultant sequence will be fully evaluated.

 I imagine that this is the reason that the former seems faster to you.

 --g

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




-- 
E-mail sent by Daniel Díaz Casanueva

let f x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Gloss and relatively expensive computations

2012-12-30 Thread Daniel Díaz Casanueva
Hi Artyom!

Thanks for your response. It seems your tactic has worked. I was so focused
on programming inside the gloss parameter that I completely forgot about
programming in the outside. Here is what I did (I picked MVar's):

myprog s = do
 ...
 var - newMVar w0
 let loop w = do
   w' - step s w
   putMVar var w'
   loop w'
 forkIO $ loop w0
 simulateIO ...  (\_ _ w - fmap (fromMaybe w) $ tryTakeMVar var)

And it's working just fine!

Best regards,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Object Oriented programming for Functional Programmers

2012-12-30 Thread Daniel Díaz Casanueva
Hello, Haskell Cafe folks.

My programming life (which has started about 3-4 years ago) has always been
in the functional paradigm. Eventually, I had to program in Pascal and
Prolog for my University (where I learned Haskell). I also did some PHP,
SQL and HTML while building some web sites, languages that I taught to
myself. I have never had any contact with JavaScript though.

But all these languages were in my life as secondary languages, being
Haskell my predominant preference. Haskell was the first programming
language I learned, and subsequent languages never seemed so natural and
worthwhile to me. In fact, every time I had to use another language, I
created a combinator library in Haskell to write it (this was the reason
that brought me to start with the HaTeX library). Of course, this practice
wasn't always the best approach.

But, why I am writing this to you, haskellers?

Well, my curiosity is bringing me to learn a new general purpose
programming language. Haskellers are frequently comparing Object-Oriented
languages with Haskell itself, but I have never programmed in any
OO-language! (perhaps this is an uncommon case) I thought it could be good
to me (as a programmer) to learn C/C++. Many interesting courses (most of
them) use these languages and I feel like limited for being a Haskell
programmer. It looks like I have to learn imperative programming (with side
effects all over around) in some point of my programming life.

So my questions for you all are:

* Is it really worthwhile for me to learn OO-programming?

* If so, where should I start? There are plenty of functional programming
for OO programmers but I have never seen OO programming for functional
programmers.

* Is it true that learning other programming languages leads to a better
use of your favorite programming language?

* Will I learn new programming strategies that I can use back in the
Haskell world?

Thanks in advance for your kind responses,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: haskell-docs - Given a module name and a name, it will find and display the documentation of that name.

2012-12-27 Thread Daniel Díaz Casanueva
This is something I always missed. Thank you!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Gloss and relatively expensive computations

2012-12-27 Thread Daniel Díaz Casanueva
Hello cafe!

I'm having some performance issues trying to use gloss to make animations
where each model step is relatively time expensive. I'm using the
IO.Simulate module because my step function needs to do an IO operation
which takes around 1 second (it may vary).

I will try to give some details.

I have the step function:

step :: Model - IO Model
step m = do
 ...
 p - slowOperation
 ...
 return newModel

The rest of the program is small and simple. The drawing function (Model -
IO Picture -- it is pure though) is as quick as simple. However, the
program get stuck after the first iteration.

In the other hand, I am using the animateIO function which ask me for an
Int value to set up the number of simulation steps to take for each second
of real time. But I'm more interested in the animation waiting for the
simulation step to end. Does it make sense?

I would be really thankful with any pointer here.

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


Re: [Haskell-cafe] Problem with forall type in type declaration

2012-05-04 Thread Daniel Díaz Casanueva
If one parameter is not enough, you always can add more:

Test m a b = Test { f :: m IO a - IO b }

This way, if

run :: m IO a - IO a

then

Test run :: Test m a a

But for other type for your run function

run' :: m IO a - IO b

you get

Test run' :: Test m a b

So you can have different types in input and output. Anyway, your type 'm'
is applied to other two types (m IO a), so it cannot be a monad, because
monads have arity 1 as type constructors, i.e. monads have kind (* - *).
Is perhaps 'm' some kind of monad transformer?

Well, that's all I can say from your explanation of the problem! Hope it
helps!

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


[Haskell-cafe] Cabal try to install a package I already have

2012-04-29 Thread Daniel Díaz Casanueva
Hi Cafe,

today I opened the command prompt and typed cabal install ftphs. Then I
read:

 Resolving dependencies...
 Configuring network-2.3.0.5...

And I started to feel confused. Because I already have installed that
package with that version! I continued reading:

 cabal: The package has a './configure' script. This requires a Unix
 compatibility toolchain such as MinGW+MSYS or Cygwin.

Yes, I knew this would happen! (thought I don't like it with a so
common-used library) But I can't understand why cabal is trying to install
network-2.3.0.5. If I type ghc-pkg list I can see precisely
network-2.3.0.5 is installed. In fact, 2.3.0.5 is the version that comes
with the Haskell Platform I recently installed (2011.4.0.0) as you can see
here: http://code.haskell.org/haskell-platform/haskell-platform.cabal.

Could someone, please, explain me this? I will be very glad. I was working
with ghc-7.4 but I needed the network package so I switched to the Haskell
Platform, because install network in Windows is painful. Yes, I read the
Mitchell guide (found in
http://neilmitchell.blogspot.com.es/2010/12/installing-haskell-network-library-on.html),
but once I installed the library I was having compile time error with
unknown symbol errors. I felt very odd so I switched this machine to the
Haskell Platform.

I hope someone could help me.
Thanks in advance,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal try to install a package I already have

2012-04-29 Thread Daniel Díaz Casanueva
Indeed, it seems to be for parsec:

? ghc-pkg latest bytestring
bytestring-0.9.1.10

? ghc-pkg latest parsec
parsec-3.1.2

Haskell Platform versions: bytestring-0.9.1.10, parsec-3.1.1.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal try to install a package I already have

2012-04-29 Thread Daniel Díaz Casanueva
I have spent some time and, when I unregistered (with ghc-pkg unregister)
all dependencies (even indirect dependencies) I have installed since I have
the Haskell Platform, then the cabal install ftphs worked.

Now I feel I understand the problem, but still seems annoying.

Thanks for the pointer, Jeff. I didn't know the reason of your question,
but then I saw dependencies of network and thought: eureka!.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Announce: HaTeX 3.3

2012-04-29 Thread Daniel Díaz Casanueva
Greetings Haskellers!

A new version of HaTeX is ready to use in Hackage:

http://hackage.haskell.org/package/HaTeX-3.3

== Description ==

HaTeX is a heavily maintained LaTeX code parser/generator. Write LaTeX
documents with all the advantages you already have in Haskell (recursion,
type system, high order functions, ...), create a LaTeX backend for your
own program, make analysis of LaTeX code through its Abstract Syntax Tree
(AST), find another way to pretty-printing values, ...

== Release notes ==

Please, to read the release notes go to the following blog post:

http://deltadiaz.blogspot.com.es/2012/04/hatex-33-release-notes.html



Thanks and good luck,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [ANNOUNCE] HaTeX 3.2

2012-02-20 Thread Daniel Díaz Casanueva
Hello,

A new version (3.2) of HaTeX has been released today to Hackage:

http://hackage.haskell.org/package/HaTeX-3.2

HaTeX is the LaTeX language syntax implementation done in Haskell. Key
changes in this version are:

+ LaTeX parser implemented (so new dependency on parsec).
+ Greek alphabet added to AMSMath module.
+ New LaTeX package implemented: graphicx.
+ Function 'documentclass' changed.

Further information on this release:

http://deltadiaz.blogspot.com/2012/02/hatex-chapter-32.html

Library homepage:

http://dhelta.net/hprojects/HaTeX

Thanks for reading,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] [Haskell] [ANNOUNCE] JuicyPixels 1.0 - image loading library

2012-01-13 Thread Daniel Díaz Casanueva
Thanks for this upload! I searched something like this a time ago. I'll
test it soon and, if I have any issue, send you some feedback. Thanks again
for the work. I made a library to work with PPM images (not released to
Hackage), but I'm glad to see a Haskell implementation of PNG and JPG.

Good luck,
Daniel Díaz.

On Fri, Jan 13, 2012 at 6:26 PM, Vincent Berthoux 
vincent.berth...@gmail.com wrote:

 Hello,

 I'd like to announce the first release of JuicyPixels, an image loading
 library written entirely in Haskell. The focus of this library is ease of
 use and correct loading. In this first version the library is capable of
 the following actions :

  - PNG(.png)
 * Reading
 - 1,2,4,8 bits loading, Grayscale, 24bits, 24 bits with alpha,
   interleaved  filtered (fully compliant with the standard,
   tested against png suite).

 * Writing
 - 8bits RGB (non interleaved)
 - 8bits RGBA (non interleaved)
 - 8bits greyscale (non interleaved)

  - Bitmap (.bmp) (mainly used as a debug output format)
 * Reading
 - 24bits (RGB) images

 * Writing
 - 32bits (RGBA) per pixel images
 - 24bits (RGB) per pixel images
 - 8 bits greyscale (with palette)

  - Jpeg   (.jpg, .jpeg)
 * Reading non-interlaced baseline DCT image, seems to be OK
 * Writing : none yet

 I'm interested on any feedback regarding ease of use, performance and bugs.

 GitHub : https://github.com/Twinside/Juicy.Pixels
 Hackage : http://hackage.haskell.org/package/JuicyPixels

 Thanks
 Vincent Berthoux


 ___
 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


[Haskell-cafe] ANNOUNCE: HaTeX 3.1.0 (and HaTeX-meta 1.1.0)

2011-12-09 Thread Daniel Díaz Casanueva
Hello Cafe!

Today I released to Hackage a new version of the HaTeX package (
http://hackage.haskell.org/package/HaTeX-3.1.0 ).

If you don't know HaTeX, it is a combinator library of the LaTeX syntax.
Visit the homepage for more information: http://dhelta.net/hprojects/HaTeX

Highlights:

+ Added warnings (See Text.LaTeX.Base.Warnings). Still very experimental.

+ Added an Examples directory, with a simple example inside to get
started.

+ Num instance for LaTeX and LaTeXT.

+ New package implemented AMSThm (See Text.LaTeX.Packages.AMSThm).

See the ReleaseNotes in the source tarball for more details in release
changes.

With it, I released an update of HaTeX-meta (version 1.1.0), which produces
part of the HaTeX code. An important change here is the addition of the
HATEX pragma (explained in
http://deltadiaz.blogspot.com/2011/11/hatex-pragma.html ).

If you need something more, feel free to contact me or send me a patch.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Overloaded Strings as default

2011-11-28 Thread Daniel Díaz Casanueva
Hi Cafe,

I only feel curious about what would be the consequences of becoming the
Overloaded Strings feature (currently, an extension) to be default in
Haskell. This is not a proposal. I just want to know what pros and
cons there are.

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Daniel Díaz Casanueva
How about to a new optional Cabal field like mail-report? (don't bother
about this name, I chose it randomly)

If a build failure happens, or there is some relevant information about
your package, Hackage will send a mail to the direction specified in that
field. A field which content will NOT appear in the package page, so
internet bots can't record so easily your mail direction to send you real
spam. This is the reason because I write my direction in the name at
domine dot com form (since a while ago), in spite of I would really like
to receive mails about fails in those packages I maintain.

Furthermore, since the field would be optional, you still can avoid to
receive these mails.

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


Re: [Haskell-cafe] Hackage feature request: E-mail author when a package breaks

2011-11-01 Thread Daniel Díaz Casanueva
Then, the mailing list seems to be an option. But then I will receive mails
for every package, and there is a lot of packages! Is not a lot of mails
this? There is another work around?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] SpecConstr message while compiling

2011-10-23 Thread Daniel Díaz Casanueva
Hi, cafe!

I wrote a program and had the following message while compiling (with -O2):

SpecConstr
Function `addOc{v s6RL} [lid]'
  has four call patterns, but the limit is 3
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations

What it means? Is it bad? It only happens when compiling with -O2.

addOc is a local function (defined in a where clause). If it helps, here is
the definition:

addOc x [] = [(x,1)]
addOc x ((y,n):ys) = if x == y then (y,n+1) : ys
   else (y,n) : addOc x ys

I want to know if there is something wrong or a I don't need to take care
about this.

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


Re: [Haskell-cafe] SpecConstr message while compiling

2011-10-23 Thread Daniel Díaz Casanueva
Thank you, good response!

Anyway, I'm not specially aware about the speed in that section of the
program. The really big work is done in other places. Also, addOc runs in
lists of 300~400 as maximum (but only in special inputs, average is under
200), so the time difference can't be improved notoriously, and I won't see
changes in performance.

But I will follow your pointers when necessary in the future.
On Sun, Oct 23, 2011 at 7:50 PM, Daniel Fischer 
daniel.is.fisc...@googlemail.com wrote:

 On Sunday 23 October 2011, 19:33:55, Daniel Díaz Casanueva wrote:
  Hi, cafe!
 
  I wrote a program and had the following message while compiling (with
  -O2):
 
  SpecConstr
  Function `addOc{v s6RL} [lid]'
has four call patterns, but the limit is 3
  Use -fspec-constr-count=n to set the bound
  Use -dppr-debug to see specialisations
 
  What it means? Is it bad? It only happens when compiling with -O2.

 It's nothing serious.
 It's just a message (that accidentally was output by default in the 7.0.*
 series) that the spec-constr pass could have done more specialising, but
 the limit forbade it.

 More specialising on constructors means

 - certainly bigger code
 - potentially faster code

 but it could also become slower (most likely because of worse cache
 locality).

 It's not even a warning, just a notification.

 
  addOc is a local function (defined in a where clause). If it helps, here
  is the definition:
 
  addOc x [] = [(x,1)]
  addOc x ((y,n):ys) = if x == y then (y,n+1) : ys
 else (y,n) : addOc x ys
 
  I want to know if there is something wrong or a I don't need to take
  care about this.

 You need not take care of it, but you can try out and pass
 -fspec-constr-count=N
 on the command line (here, N = 4 is a good start) to see if the generated
 code is faster.

 
  Thanks in advance,
  Daniel Díaz.


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


[Haskell-cafe] SSH in community.haskell.org

2011-10-13 Thread Daniel Díaz Casanueva
Hi Cafe!

This is not actually a question about Haskell, but it is related. I sent my
request and I have now an account in community.haskell.org. When I was going
to use my project, I read these instructions:

http://community.haskell.org/admin/using_project.html

But I stopped in the first step If you need to use a shell, SSH to
community.haskell.org.

OK, I don't have too knowledge in SSH, so I searched the web and found
putty as an SSH client. I downloaded it and tried it. But, sadly, without
success.

I put this configuration:

Host name: community.haskell.org
Port: 22
Connection type: SSH

And it connects! Then, server asks me for an user name, and, after I put my
user name, it throws the following error:

Disconnected: No supported authentication methods available (server sent:
publickey).

Uh... I have no idea of how to avoid this error. Wrong client? Wrong
configuration? Well, I have a public key I didn't put anywhere yet (but in
the community registration). I guess I'm lacking some authentication, but I
don't know how to solve it.

I hope someone can give me some pointers!

Thanks in advance!
And sorry if this is not a strictly-related Haskell question.

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


Re: [Haskell-cafe] SSH in community.haskell.org

2011-10-13 Thread Daniel Díaz Casanueva
Thanks JP and Ivan for the quick response!

Anyway, it seems I lack the private key mentioned (all I have is the public
key), and that sounds bad.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANNOUNCE: HaTeX 3 - First release

2011-10-06 Thread Daniel Díaz Casanueva
Hello, folks!

I have just released HaTeX 3 to Hackage:

http://hackage.haskell.org/HaTeX

It is a first version, not well documented yet, but now you can test it with
a simple cabal install hatex.

What is HaTeX?
HaTeX consists in a set of combinators which allow you to build LaTeX code,
following the LaTeX syntax in a type-safe manner. This allows you to build
programs which generates LaTeX code automatically for any purpose you can
figure out.

Further reading about HaTeX 3:

* http://deltadiaz.blogspot.com/2011/09/hatex-3-previous-notes.html
* http://deltadiaz.blogspot.com/2011/10/hatex-3-two-styles.html

I wanted to make the release before end the proper documentation because:
1) This allow people to test the library (and hence, help me to build the
documentation if any feedback comes).
2) I am too busy currently and I can't expend to HaTeX the time I'd like.

The library may need some improvements, but it worked well for my own tests.

With HaTeX, I uploaded the HaTeX-meta package. This package is needed if you
want to develope a subset of the HaTeX modules, because they are
automatically generated by this application. Anyway, there are notes in the
API reference warning this. HaTeX-meta in Hackage:

http://hackage.haskell.org/HaTeX-meta

A continously updated version of the source code from these packages can be
found at:

http://dhelta.net/hprojects/HaTeX/code
http://dhelta.net/hprojects/HaTeX-meta/code

Thanks for reading,
Daniel Díaz.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: HaTeX 3 - First release

2011-10-06 Thread Daniel Díaz Casanueva
It seems there is an error in the hackage URL's.

Working URL's:

http://hackage.haskell.org/package/HaTeX
http://hackage.haskell.org/package/HaTeX-meta

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


Re: [Haskell-cafe] Installing Gtk2Hs on Win32

2011-06-10 Thread Daniel Díaz Casanueva
Hi, Dmitri,

here is newer guide, with updated links:

http://deltadiaz.blogspot.com/2011/03/on-windows-how-to-install-gtk.html

Hope it helps!


On Fri, Jun 10, 2011 at 5:30 PM, Dmitri O.Kondratiev doko...@gmail.comwrote:

 Please help to find pre-compiled binary libraries of Gtk+ for Win32.

 Gtk2Hs insatll instructions at:
 http://code.haskell.org/gtk2hs/INSTALL

 tells us:

 [quote]
 Building on Windows
 

 Installation on Windows is nearly as easy as on Unix platforms. However,
 you
 need to download the pre-compiled binary libraries of Gtk+ and all it's
 dependent libraries. Point your browser to

 http://www.gtk.org/download-windows.html

 and download one of the All-in-one bundles. Note that you do *not* need
 to
 install MinGW nor MSys (but it does not hurt if they are installed on your
 system). Install the binaries by unpacking them into a directory without
 spaces.
 [/quote]

 This link (http://www.gtk.org/download-windows.html) is dead.
 Where to get pre-compiled binary libraries of Gtk+ ?

 Thanks!

 ___
 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] ANNOUNCE: Clipboard-2.2.0. System clipboard interface.

2011-05-30 Thread Daniel Díaz Casanueva
Hi all,

I've just uploaded Clipboard-2.2.0 to Hackage [1].

Clipboard [2] is a library that provides an interface for the system
clipboard. The API is very simple, so anyone can use it without knowing of
low-level Win32 API. Currently, this library only works on a Windows OS, due
to its dependency on the Win32 library.

Features for 2.2.0 version:

* Added compatibility with the unicode character set, while reading the
content of the clipboard.

* Unicode character set is the new standard for setting the clipboard
content.

* Fixed the function 'modifyClipboardString'.

* Some changes in documentation.

I want to give thanks to Artyom Kazak, who sent me the patch of Unicode
compatibilty and the fix for 'modifyClipboardString' function.

-- References

[1] - Hackage site - http://hackage.haskell.org
[2] - Clipboard site -
http://sites.google.com/site/dheltadiaz/packages/clipboard
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe