News aggregator

Why no subtyping/subtype polymorphism?

Haskell on Reddit - Thu, 01/21/2016 - 9:20pm
<!-- SC_OFF --><div class="md"><p>Is there some reason these features conflict with Haskell philosophy?</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

Munich Haskell Meeting, 2016-01-25 < at > 19:30

haskell-cafe - Thu, 01/21/2016 - 3:15pm
Dear all, Next week, our monthly Munich Haskell Meeting will take place again on Monday, January 25 at Cafe Puck at 19h30. For details see here: http://chneukirchen.github.io/haskell-munich.de/dates If you plan to join, please add yourself to this dudle so we can reserve enough seats! It is OK to add yourself to the dudle anonymously or pseudonymously. https://dudle.inf.tu-dresden.de/haskell-munich-jan-2016/ Everybody is welcome! cu,
Categories: Offsite Discussion

How to make this tableHeaders work with the boxes library

Haskell on Reddit - Thu, 01/21/2016 - 3:13pm
<!-- SC_OFF --><div class="md"><p>Hello, </p> <p>I have now this : </p> <pre><code>module Lib where data Table = Table {tableHeaders :: [String], tableData :: [[String]]} exampleData :: Table exampleData = Table { tableHeaders = [&quot;Cat Name&quot;, &quot;Age&quot;], tableData = [[&quot;Mr Bigglesworth&quot;, &quot;205&quot;], [&quot;Crazy Cat&quot;, &quot;50&quot;]] } printTable :: String -&gt; Table -&gt; Box printTable title bank = let heading = alignHoriz center1 40 (text title) tablehead = leftright (tableHeaders bank) --contents = vcat left (map accountRow bank) in heading -- /+/ tablehead /+/ contents -- accountRow :: PrintItem -&gt; Box -- accountRow (name, amount) = -- leftright name (show amount) leftright lft rght = let leftBox = alignHoriz left 27 (text lft) rightBox = alignHoriz right 12 (text rght) in leftBox &lt;+&gt; rightBox </code></pre> <p>Now im wonder how I can take that the tableHeaders are being printed by the lefright function. Right now its a list with 2 items. But I can be more on other exampledata's .</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

Regex library for custom containers

Haskell on Reddit - Thu, 01/21/2016 - 1:10pm
<!-- SC_OFF --><div class="md"><p>Is there a haskell regex library that can operate on custom containers? (E.g. where I have to implement some typeclass)</p> <p>Thanks in advance!</p> <p>Btw, I tried to read the source code of the yi editor to find out how they do it but I couldn't figure it out.</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

an automatic refactoring idea

haskell-cafe - Thu, 01/21/2016 - 10:08am
I had a data structure with a redundant field [1]. I refactored to make that field go away. Here is the code [2]. The following is a simplification of it. I was using this type: data X = X1 | X2 Int To make the Int go away, I made a duplicate type: data X' = X1' | X2' Then, every function for which any argument was of type X, I similarly duplicated, replacing every X with X', X1 for X1', and X2 for X2'. Next I had to similarly duplicate every function that used one of those. And so on, and so on ... until eventually I was duplicating the tests. At that point I was able to determine from the duplicate tests that everything was working. There was a little more work involved than that, but the vast, vast majority of the edits that got me there were the simple duplication I just described. I looked once at automatic refactoring in Haskell and was either unimpressed or scared. I may not have understood what I was looking at enough to appreciate its power. Is there something that can do the refactoring
Categories: Offsite Discussion

First class commands and free monads

Haskell on Reddit - Thu, 01/21/2016 - 9:50am
<!-- SC_OFF --><div class="md"><p>I saw <a href="http://raganwald.com/2016/01/19/command-pattern.html">this article about first class commands</a> over <a href="https://www.reddit.com/r/programming/comments/41v00n/firstclass_commands_the_annotated_presentation/">on r/programming</a>, and the way the author discussed commands reminded me a lot of free monads.</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

2D List/Vector Performance?

Haskell on Reddit - Thu, 01/21/2016 - 6:38am
<!-- SC_OFF --><div class="md"><p>Hi everyone,</p> <p>I would love to know the performance of the following variable:</p> <pre><code> a = [1,2,3,4,5] b = [[11,12,13,14,15],[21,22,23,24,25],[31,32,33,34,35],[41,42,43,44,45],[51,52,53,54,55]] c = Data.Vector.fromList b </code></pre> <p>If it takes O(4) to access a!!4, how long does it takes to access b!!4, b!!4!!4, c!!4, c!!4!!4?</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

Streaming a Unix tool's output to Haskell?

Haskell on Reddit - Thu, 01/21/2016 - 3:56am
<!-- SC_OFF --><div class="md"><p>I'm looking into making a simple wget frontend with Haskell. The idea I had was to just have a Haskell server that can instantiate wget requests and report back on the progress. Concretely, that would require the following things:</p> <ul> <li>Execute a command via Haskell (shouldn't be too hard)</li> <li>Monitor the command's output (No idea how...)</li> <li>Interpret the output and send it to a web client (I'll work that out once I get there)</li> </ul> </div><!-- SC_ON --> submitted by
Categories: Incoming News

PostgreSQL Simple FromField help

Haskell on Reddit - Thu, 01/21/2016 - 2:55am
<!-- SC_OFF --><div class="md"><p>For the love of me I can't figure out how to use FromField in postgresql-simple package.</p> <p>I have a custom type in my code :</p> <pre><code>data Role = Staff | Student deriving (Eq, Ord, Show) </code></pre> <p>I intend to use integers 1 and 2 in postgres to represent these two values but I simply can't figure out how to convert integer in database to Role in Haskell using FromField.</p> <p>Example on hackage is not really helping me much here.</p> <p><a href="https://hackage.haskell.org/package/postgresql-simple-0.5.1.2/docs/Database-PostgreSQL-Simple-FromField.html">postgresql-simple on hackage</a></p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

&quot;Haskell Design Patterns&quot; any good?

Haskell on Reddit - Thu, 01/21/2016 - 2:22am
<!-- SC_OFF --><div class="md"><p>I saw this <a href="https://www.packtpub.com/application-development/haskell-design-patterns">Haskell Design Patterns / pact</a> on the <a href="https://wiki.haskell.org/Books">books HaskellWiki page</a></p> <p>Is this a good resource (well pact seems not to have the best reputation)?</p> <hr/> <p>Seems as this book is not really all that great - sad I fell like there is should be a good book bridging the gap between LYAH and most of the papers out there.</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

Can this be ported to Haskell

Haskell on Reddit - Thu, 01/21/2016 - 1:59am
<!-- SC_OFF --><div class="md"><p>Hello, </p> <p>I like the way this clojure plugin is working: <a href="https://github.com/joegallo/doric">https://github.com/joegallo/doric</a></p> <p>Can this also be done in Haskell and how. I tried it myself to do with the boxes library but no luck so far.</p> <p>Roelof</p> </div><!-- SC_ON --> submitted by
Categories: Incoming News

[Template Haskell Question] On defining recursivetemplates.

haskell-cafe - Wed, 01/20/2016 - 9:01pm
Hello Haskellers, I'm currently diving into Template Haskell and I just read the original TH paper [1]. There they give the following example of a generic zip function:
Categories: Offsite Discussion

Demo of IHaskell Notebook [video]

Haskell on Reddit - Wed, 01/20/2016 - 7:54pm
submitted by
Categories: Incoming News

localized memory management?

haskell-cafe - Wed, 01/20/2016 - 4:53pm
Dear cafe, how would you approach this task: find (enumerate) those x from a list xs for which some computation is not successful within some resource bound (it weeds out uninteresting data, leaving just the hard cases, which will be treated later by other means) Input and result could be lazy lists, computations are pure. If the bounded resource is time, then I can use System.Timeout. This puts me into IO, but OK. Perhaps I want to do some logging output anyways. The problem is with bounding space. Assume that "computation on x" (sometimes) allocates a lot. Then the whole program will just die with "heap exhausted", while in fact I want to terminate just the computation on this x, garbage-collect, and continue. I could make the space usage explicit: each step of the computation could additionally compute a number that approximates memory usage. (Assume that this usage varies wildly with each step.) Then I can stop iterating when this reaches some bound. Or, I just compile the computation into
Categories: Offsite Discussion

An introduction to building GHC type-checker plugins

Haskell on Reddit - Wed, 01/20/2016 - 4:17pm
submitted by
Categories: Incoming News