Njagi Mwaniki | 22 Dec 16:03 2014
Picon

Google Summer of Code


Which books or resources or libraries should one read to get ready for
the Google summer of code? Also which projects would be easiest to work
on for beginners?

Anything that would make one ready for Google summer of code and
complete their project with ease.

I'm currently taking cs194 from upenn online
http://www.seas.upenn.edu/~cis194/lectures.html
Sagar Srivastava | 21 Dec 17:24 2014
Picon

Getting started with Haskell

Hello All!

I'm Sagar, from India.I'm a sophomore at BITS Pilani,Hyderabad ,currently pursuing a B.E(Hons) degree in Computer Science.

I've just started learning Haskell and i was aiming to participate in this year's Google Summer of Code,and so i was wondering if
i could get comfortable enough with the language ,given enough effort so that i might be able to contribute to the project and maybe participate in GSoC with this organization.

Also,wishing all of you a Merry Christmas and a Happy New Year! :)

Regards,
Sagar
<div><div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>Hello All!<br><br>
</div>I'm Sagar, from India.I'm a sophomore at BITS Pilani,Hyderabad ,currently pursuing a B.E(Hons) degree in Computer Science.<br>
</div>
<div><br></div>I've just started learning Haskell and i was aiming to participate in this year's Google Summer of Code,and so i was wondering if <br>
</div>i could get comfortable enough with the language ,given enough effort so that i might be able to contribute to the project and maybe participate in GSoC with this organization.<br><br>
</div>Also,wishing all of you a Merry Christmas and a Happy New Year! :)<br><br>
</div>Regards,<br>
</div>Sagar <br>
</div></div>
Pascal Knodel | 19 Dec 02:39 2014
Picon

Does/How does GHC/Haskell optimize this ('almost identical associative expressions', pattern matching reordering)

Hi all,

a) I've learned that Haskell uses graphs (graph reduction) to do
optimizations / 'sharing'. Calculation example:

--    (1 + 2) + (1 + 2)
-- ~> 3 + 3
-- ~> 6

in contrast to

--    (1 + 2) + (3 + 0)
-- ~> 3 + (3 + 0)
-- ~> 3 + 3
-- ~> 6

What does it do in a case like:

... min 0 1 ... min 1 0 ...,

or: (1 + 2) + (2 + 1)

where a function definition is used which has the same result
in both cases, but arguments are flipped. This is a simple example
for a very general problem.
What does the underlying system do about it?
(a1) Can it detect and optimize it? In the example it would be easy to 
reduce
it to the relations that define the min function. Is GHC able to detect
it? (a2) Is there a super language to Haskell, like an speci. assembler in
other paradigms, that could split code into even smaller pieces?
(a3) What happens at run-time, for example: ... min a b ... min b a ...?

b) About 'pattern matching': Does Haskell reorder
patterns for optimization? How/what technique does it use there? Example:

...
f [] = ...
f (a : as) = ... f ( b(a) ) ...
...

VS.

...
f (a : as) = ... f ( b(a) ) ...
f [] = ...
...

If Haskell does pattern matching like I've been told: top down, the first
definition would statistically be inefficient, because recursive 
functions are
normally called with the intension to do some (recursive) calculations. 
I tested (*)
it (without optimization). What do I need to know to understand this 
behavior?

* Tests were (+RTS -<test> -RTS):

-------------------- snip --------------------
module Test where

f1 :: String -> String
f1 [] = []
f1 [a1] = [a1]
f1 [a1,a2] = [a1,a2]
f1 [a1,a2,a3] = [a1,a2,a3]
f1 [a1,a2,a3,a4] = [a1,a2,a3,a4]
f1 [a1,a2,a3,a4,a5] = [a1,a2,a3,a4,a5]
f1 [a1,a2,a3,a4,a5,a6] = [a1,a2,a3,a4,a5,a6]
f1 (a1 : a2 : a3 : a4 : a5 : a6 : a7 : as) = f1 as

f2 :: String -> String
f2 (a1 : a2 : a3 : a4 : a5 : a6 : a7 : as) = f2 as
f2 [a1,a2,a3,a4,a5,a6] = [a1,a2,a3,a4,a5,a6]
f2 [a1,a2,a3,a4,a5] = [a1,a2,a3,a4,a5]
f2 [a1,a2,a3,a4] = [a1,a2,a3,a4]
f2 [a1,a2,a3] = [a1,a2,a3]
f2 [a1,a2] = [a1,a2]
f2 [a1] = [a1]
f2 [] = []

p1 :: IO ()
p1 =  print $ f1 [' ' | _ <-[1 .. 10^9] ]   -- 63.87 secs

p2 :: IO ()
p2 =  print $ f2 [' ' | _ <-[1 .. 10^9] ]   -- 62.68 secs
-------------------- snip --------------------
chao chu | 17 Dec 18:55 2014
Picon

Anyone here self-studying upenn's CIS 552 taught by Benjamin Pierce

Hi,


I found the lecture and lab materials are very good and I am self-studying the course by reading the lecture notes and doing the labs on my own.

Just want to check if anyone is also following the course so that we can form a study group to discuss whatever we want about the course and also about learning haskell.

Thanks & Regards,

--
ChuChao
<div><div dir="ltr">Hi,<div><br></div>
<div>The course website:&nbsp;<a href="http://www.seas.upenn.edu/~cis552/">http://www.seas.upenn.edu/~cis552/</a>
</div>
<div><br></div>
<div>I found the lecture and lab materials are very good and I am self-studying the course by reading the lecture notes and doing the labs on my own.</div>
<div><br></div>
<div>Just want to check if anyone is also following the course so that we can form a study group to discuss whatever we want about the course and also about learning haskell.</div>
<div><br></div>
<div>Thanks &amp; Regards,<br clear="all"><div><br></div>-- <br><div class="gmail_signature">ChuChao</div>
</div>
</div></div>
Zach Moazeni | 16 Dec 01:38 2014
Picon

Why does Haskell PVP have two values for the major version? "A.B..." and a couple other questions

Hello,

Forgive me if this is a frequently asked question, I've searched the web and can't find an answer.

What is the history that led up to the PVP specifying two values as the major version?

I come from other tools that primarily use http://semver.org/ (or a variant) and I'm confused in what cases I should bump "A" but not "B" (or bump "B" but not "A")?

A concrete example: If I make backwards incompatible changes to a package whose latest version is 1.0.x, should the next version be 2.0.x or 1.1.x? What sorts of things should I consider for choosing 2.0 over 1.1 and vice versa?


Another question, by far most packages I have encountered either lead with a 0 or a 1 for "A". Does that have some bearing on the long term stability that package users should expect in the future?

Finally, if "1.0.x.." is meant to convey a level of long term support, does "B" get rarely used? Since "C" version bumps to include backwards compatible additions, and "D"+ for backwards compatible bug fixes. (I know "D" isn't technically a PVP category, I'm just relating it to the patch version of semver).

Thanks for your help!
-Zach
<div><div dir="ltr">
<div>
<div>
<div>
<div>
<div>Hello,<br><br>
</div>Forgive me if this is a frequently asked question, I've searched the web and can't find an answer.<br><br>
</div>What is the history that led up to the <a href="https://www.haskell.org/haskellwiki/Package_versioning_policy" target="_blank">PVP</a> specifying two values as the major version?<br><br>
</div>I come from other tools that primarily use <a href="http://semver.org/" target="_blank">http://semver.org/</a> (or a variant) and I'm confused in what cases I should bump "A" but not "B" (or bump "B" but not "A")?<br><br>
</div>A concrete example: If I make backwards incompatible changes to a package whose latest version is 1.0.x, should the next version be 2.0.x or 1.1.x? What sorts of things should I consider for choosing 2.0 over 1.1 and vice versa?<br><br><br>
</div>
<div>Another question, by far most packages I have encountered either lead with a 0 or a 1 for "A". Does that have some bearing on the long term stability that package users should expect in the future?<br><br>
</div>
<div>Finally, if "1.0.x.." is meant to convey a level of long term support, does "B" get rarely used? Since "C" version bumps to include backwards compatible additions, and "D"+ for backwards compatible bug fixes. (I know "D" isn't technically a PVP category, I'm just relating it to the patch version of semver).<br><br>
</div>
<div>Thanks for your help!<br>
</div>
<div>-Zach<br>
</div>
</div></div>
Riaan | 15 Dec 09:45 2014

Haskell type conversion for postgresql array types

This is a question about database query libraries.  I am trying to do some analytics on a Postgresql database and up to now have been using Database.HDBC for most of my querying.

One of the columns on the database is a two dimensional float8 array.  I tried using Database.PostgreSQL.Simple but got stuck on this array as I could not figure out how to extend the built in conversion functions to cater for something like this.  So went back to HDBC.  But now my queries are starting to get fairly long and I have been looking at libraries like Persistent with Esqualeto, HaskellDB and Groundhog to make my queries a little more composable and type safe.  

However I have not been able to find any examples of any of these libraries using postgres arrays and given my postgresql-simple experience I worried that I might similarly be unable, because of my low level of haskell ability, to extend the conversion functions.

So to my question.  Does anyone have experience with one of these libraries in dealing with postgresql arrays and could someone perhaps send me a simple example that I could use as a basis.  Failing that, can anyone advise me on which of these libraries have the most haskell newbie (LYAH trained, but still struggling with RWH) friendly approach to writing new conversion functions?

Thanks
<div><div dir="ltr">
<span>This is a question about database query libraries.&nbsp; I am trying to do some analytics on a Postgresql database and up to now have been using Database.HDBC for most of my querying.</span><div><br></div>
<div>One of the columns on the database is a two dimensional float8 array.&nbsp; I tried using Database.PostgreSQL.Simple but got stuck on this array as I could not figure out how to extend the built in conversion functions to cater for something like this.&nbsp; So went back to HDBC.&nbsp; But now my queries are starting to get fairly long and I have been looking at libraries like Persistent with Esqualeto, HaskellDB and Groundhog to make my queries a little more composable and type safe. &nbsp;</div>
<div><br></div>
<div>However I have not been able to find any examples of any of these libraries using postgres arrays and given my postgresql-simple experience I worried that I might similarly be unable, because of my low level of haskell ability, to extend the conversion functions.</div>
<div><br></div>
<div>So to my question.&nbsp; Does anyone have experience with one of these libraries in dealing with postgresql arrays and could someone perhaps send me a simple example that I could use as a basis.&nbsp; Failing that, can anyone advise me on which of these libraries have the most haskell newbie (LYAH trained, but still struggling with RWH) friendly approach to writing new conversion functions?</div>
<div><br></div>
<div>Thanks</div>
</div></div>
Pascal Knodel | 15 Dec 02:42 2014
Picon

structural induction, two lists, simultaneous

Hi list,

Proposition:

map f (ys ++ zs)  =  map f ys ++ map f zs

(Haskell, the craft of functional programming, exercise 11.31)

Almost every time I'm asked to do (structural) induction over multiple
'things', in this example lists, I don't know how to do it.
(I encountered similar difficulties when I worked through chapter 9, see
https://github.com/pascal-knodel/haskell-craft/tree/master/Chapter%209 ,
ex. 9.5 , 
https://github.com/pascal-knodel/haskell-craft/blob/master/Chapter%209/E%279%27%275.hs).
I think my proof in this case isn't formally correct. It feels like it 
isn't.

I would like to do the example with your help, so that I feel a
little bit safer.

Let's start with the base case. If I have two lists, do I select
one, say  ys := [] . Only one or one after another? Or both 'parallel'?
I could state  ys ++ zs := []  too, does it help?

I could imagine that the proposition could be expanded to something like

     map f (l1 ++ l2 ++ ... ++ lN) = map f ys ++ map f zs
  =  map f l1 ++ map f l2 ++ ... ++ map f lN

And I could imagine that it is possible to do induction over more than 
two lists too.

What is the reason why we can do it over two 'objects' at the same time?
How do I start? Can you explain this to me?

Attempt:

-- ---------------
-- 1. Proposition:
-- ---------------
--
--   map f (ys ++ zs)  =  map f ys ++ map f zs
--
--
-- Proof By Structural Induction:
-- ------------------------------
--
--
--   1. Induction Beginning (1. I.B.):
--   ---------------------------------
--
--
--     (Base case 1.)  :<=>  ys := []
-- 
--       =>  (left)  :=  map f (ys ++ zs)
--                                          | (Base case 1.)
--                    =  map f ([] ++ zs)
--                                          | ++
--                    =  map f zs
--
--
--          (right)  :=  map f ys ++ map f zs
--                                               | (Base case 1.)
--                    =  map f [] ++ map f zs
--                                               | map
--                    =  map f zs
--
--
--       => (left)  =  (right)
--
--       ✔
--
--
--  1. Induction Hypothesis (1. I.H.):
--  ----------------------------------
--
--    For an arbitrary, but fixed list "ys", the statement ...
--
--      map f (ys ++ zs)  =  map f ys ++ map f zs
--
--    ... holds.
--
--
--  1. Induction Step (1. I.S.):
--  ----------------------------
--
--
--     (left)  :=  map f ( (y : ys) ++ zs )
--                                                      | ++
--              =  map f (  y : ( ys ++ zs )  )
--                                                      | map
--              =  f y : map f ( ys ++ zs )
--                                                      | (1. I.H.)
--              =  f y : map f ys ++ map f zs
--                                                      | map
--              =  map f (y : ys) ++ map f zs
--
--
--    (right)  :=  map f (y : ys) ++ map f zs
--
--
--    =>  (left)  =  (right)
--
--
--    ?■?  (1. Proof)

But in this 'proof attempt' only "ys" was considered (1. I.H.).
What do I miss?

Pascal
_______________________________________________
Beginners mailing list
Beginners <at> haskell.org
http://www.haskell.org/mailman/listinfo/beginners
martin | 14 Dec 12:15 2014
Picon

Creating Indexes

Hello all,

I recently wrote a Haskell program, which accesses Lists extensivly. That was okay to verify the overall
idea, but
performance degraded rapidly when I made the lists bigger. There was a quadratic effect and this was not surprizing,
given the nature of the code.

I am somewhat aware of Haskell types which offer faster access. But they all seem to assume that I know the way
data is
accessed when I write the type. A new access path may force me to rededign the type.

What I am looking for is something which behaves like indexes in a RDBMS, i.e. to define a list-like type on an innocent
data type (like a tuple) and then add indexes as needed. Is there such a thing?
Dontdie YCH | 14 Dec 09:26 2014
Picon

Output of `ghc-mod check` and `runhaskell`

Hello,

My current setup for haskell.

Arch Linux
nix package manager - only for haskell stuff
nix-shell
vim
syntastic + ghc-mod
guard - `cabal run` on change of '*.hs'

I would like to improve readability of ghc-mod's output. Compare to
output of runhaskell, It's quite hard to understand.

~~~
% ghc-mod check LogAnalysis.hs
LogAnalysis.hs:90:25:Couldn't match expected type
‘[ghc-prim:GHC.Types.Char]’            with actual type
‘Log.LogMessage -> [ghc-prim:GHC.Types.Char]’In the second argument of
‘(ghc-prim:GHC.Classes.==)’, namely  ‘upcase GHC.Base..
LogAnalysis.getMsg’In the expression:  str' ghc-prim:GHC.Classes.==
upcase GHC.Base.. LogAnalysis.getMsgIn the expression:  str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ x
LogAnalysis.hs:90:17:Couldn't match expected type ‘s -> t’
with actual type ‘ghc-prim:GHC.Types.Bool’Relevant bindings include  x
:: s (bound at LogAnalysis.hs:90:13)  p :: s -> t (bound at
LogAnalysis.hs:90:11)The first argument of ($) takes one argument,but
its type ‘ghc-prim:GHC.Types.Bool’ has noneIn the expression:  str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ xIn an equation for ‘p’:    p x      = str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ x

% runhaskell LogAnalysis.hs

LogAnalysis.hs:90:17:
    Couldn't match expected type ‘s -> t’ with actual type ‘Bool’
    Relevant bindings include
      x :: s (bound at LogAnalysis.hs:90:13)
      p :: s -> t (bound at LogAnalysis.hs:90:11)
    The first argument of ($) takes one argument,
    but its type ‘Bool’ has none
    In the expression: str' == upcase . getMsg $ x
    In an equation for ‘p’: p x = str' == upcase . getMsg $ x

LogAnalysis.hs:90:25:
    Couldn't match expected type ‘[Char]’
                with actual type ‘LogMessage -> [Char]’
    In the second argument of ‘(==)’, namely ‘upcase . getMsg’
    In the expression: str' == upcase . getMsg
    In the expression: str' == upcase . getMsg $ x
~~~

How I can do either

- change ghc-mod's output like runhaskell or
- use runhaskell for vim syntastic

Thanks.
_______________________________________________
Beginners mailing list
Beginners <at> haskell.org
http://www.haskell.org/mailman/listinfo/beginners
Alan Buxton | 13 Dec 14:54 2014
Picon

Deploying a haskell application (not a webapp)

Hi

 

I have created an application using cabal that now installs fine and runs fine on my dev machine.

 

I now want to deploy this application onto a separate server. This is not a webapp.

 

Try as I might, Google will not point me in the direction of how to do this, apart from loads of links to Keter which is not what I want (there is no nginx or any other web server involved).

 

Any advice on the neatest way to do this?

 

Thanks

Alan

<div><div class="WordSection1">
<p class="MsoNormal">Hi<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I have created an application using cabal that now installs fine and runs fine on my dev machine.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">I now want to deploy this application onto a separate server. This is not a webapp.<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Try as I might, Google will not point me in the direction of how to do this, apart from loads of links to Keter which is not what I want (there is no nginx or any other web server involved).<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Any advice on the neatest way to do this?<p></p></p>
<p class="MsoNormal"><p>&nbsp;</p></p>
<p class="MsoNormal">Thanks<p></p></p>
<p class="MsoNormal">Alan<p></p></p>
</div></div>
Venu Chakravorty | 13 Dec 08:44 2014
Picon

Doubts regarding the "read" function.

Hello everyone,

I am new to Haskell and this might seem very naive, please bear with me.

=======================================
Prelude> read "4" + 4
8
Prelude> (read "4" :: Int) + 4
8
Prelude> read "hello " ++ "world"
"*** Exception: Prelude.read: no parse
Prelude> (read "hello" :: String) ++ " world"
"*** Exception: Prelude.read: no parse
=======================================

Could someone please explain why the last two statements don't work?

My understanding is that "read" has a type of "read :: (Read a) => String -> a".
So, "read "hello" " should give me an instance of type "Read" to which I am
appending the string "world" (just like the first 2 cases where I get
an instance of
"Read" ("Int" in this case) to which I am adding another "Int" and I
get a "Num" which
is then displayed). I expected to see "hello world" as the output.

Is it that the type "String" is not an instance of type class "Read"?
Please tell me what
I am missing here.

Regards,
Venu Chakravorty.

Gmane