News aggregator

[Proposal] Add default implementation of mappend/mempty in terms of mconcat

libraries list - Fri, 01/24/2014 - 11:42pm
Hello, I noticed that the current Monoid class doesn't actually provide default implementations of mappend/mempty in terms of mconcat, even though this is technically very simple: This would be a rather small and non-invasive change that shouldn't break any existing programs. The main downside is that an empty Monoid declaration would produce no warnings, but #7633 gives us the ability to solve this. Discussion period: 2 weeks
Categories: Offsite Discussion

Haskell :: Reddit

Haskell on Reddit - Fri, 01/24/2014 - 10:34pm

Haskell :: Reddit cannot compile. Shouldn't it be something like instance Reddit Haskell where path r = "haskell" ?

submitted by gintere
[link] [5 comments]
Categories: Incoming News

Why is the Show instance of Text not used byshowTerm?

haskell-cafe - Fri, 01/24/2014 - 5:38pm
Hello cafe, I'm continuing my adventures with the GHC API. I'm following the code given at http://www.haskell.org/haskellwiki/GHC/As_a_library#Running_interactive_statementsto run statements like in GHCi, but the behavior sometimes puzzles me. If I load a simple module: module Test where import qualified Data.Text as T And then run the statement T.pack \"test\", I expect to see "test" back. But I get Data.Text.Internal.Text _ 0 4. If I run "show $ T.Pack \"test\"" I get the expected result. Text _ 0 4 seems to be the output of the showText debugging function in Data.Text, that I don't see used in the Show instance. And looking at the GHC code (Debugger.hs) it does perform a show of the expression given. Why doesn't it work? What subtlety am I missing? Thanks! JP
Categories: Offsite Discussion

"_ZCMain_main_closure" error when trying to use FFI.

Haskell on Reddit - Fri, 01/24/2014 - 12:06pm

Here's the thing: I'm trying to use a Haskell source as a library for C. As I'm the only one that's going to use it, I am just using foreign export ccall. So I have two source files:

test.hs:

{-# LANGUAGE ForeignFunctionInterface #-} module Test where import Foreign.C haskellPrint = print foreign export ccall haskellPrint :: CString -> IO ()

test_c.c:

#include "test_stub.h" int main(){ haskellPrint("abc"); return 0; }

And I run:

ghc test.hs ghc test.o test_c.c

I get as error:

Undefined symbols for architecture x86_64: "_ZCMain_main_closure", referenced from: _main in ghc9435_0.o ld: symbol(s) not found for architecture x86_64

The docs say that actually GHC should generate test_stub.o and test_stub.c, but as they weren't there, either the docs are too outdated or for some reason they shouldn't be generated now: anyway I used test.o instead, which doesn't work. I'm on a 10.8.5 mac, with the latest XCode, and running GHC 7.6.3(and yes, I'm pretty sure I run that script that was needed in order to make it work with the new xcode, and the rest works fine).

So what's happening? Can someone explain?

submitted by DR6
[link] [10 comments]
Categories: Incoming News

Arithmetic overflow

haskell-cafe - Fri, 01/24/2014 - 8:33am
Greetings, I have a question about arithmetic overflow in Haskell -- actually, probably specifically in GHC. It’s my understanding from the Haskell 2010 Language Report that “The results of exceptional conditions (such as overflow or underflow) on the fixed-precision numeric types [e.g. Int] are undefined; an implementation may choose error (⊥, semantically), a truncated value, or a special value such as infinity, indefinite, etc.” In the documentation for Data.Int from the current release of the Haskell Platform, I read that “All arithmetic is performed modulo 2^n, where n is the number of bits in the type.” However, there seems to be at least one exception to this promise, namely: λ> (minBound :: Int) `quot` (-1) *** Exception: arithmetic overflow Is this a bug? More specifically, is it intended to be safe to rely on the modulo arithmetic behavior of GHC in spite of the Language Report? And if so, should the above witnessed behavior still be expected? Thanks,
Categories: Offsite Discussion

JP Moresmau: Haskell Worksheet in EclipseFP 2.6

Planet Haskell - Fri, 01/24/2014 - 8:04am
A sneak preview of the worksheet functionality in the upcoming EclipseFP release. I have a Haskell module with a few functions, and the worksheet displays some results using different rendering modes:

  • Simple text: shows the result of the expression as GHCi would
  • HTML/SVG: renders HTML markup and SVG images in a SWT Browser element. In the screenshot there's Blaze HTML and Diagrams SVG
  • JSON: display JSON objects and arrays in a tree
We use BuildWrapper and the GHC API to execute the expressions every time the file is saved. The expressions are persistent and hence survive restarting Eclipse.

I don't know when EclipseFP 2.6 will be released, but you can of course get the current code from github.
Categories: Offsite Blogs

How does one read complicated type signatures?

haskell-cafe - Fri, 01/24/2014 - 5:54am
Hello world, I’ve just started playing with the http-conduit package and started inspecting type signatures of some of the functions, and I stumbled upon many things that look like this *Main Network.HTTP.Conduit> :t withManager withManager :: (monad-control-0.3.2.2:Control.Monad.Trans.Control.MonadBaseControl IO m, transformers-0.3.0.0:Control.Monad.IO.Class.MonadIO m) => (Manager -> resourcet-0.4.10:Control.Monad.Trans.Resource.Internal.ResourceT m a) -> m a The question is … how am I supposed to read these? It seems that they wrap around (maybe) 80 characters, which makes them unreadable … and the package prefixes also don’t really help. I’d like to point out here that I’m really a noob without any practical experience in Haskell, I’ve just read a few books. So I don’t have a problem understanding the concepts, but more and more often I find myself struggling just to read the type signature correctly Thanks for any tips, Jakub_____________
Categories: Offsite Discussion

hpaste.org is expiring

haskell-cafe - Fri, 01/24/2014 - 1:02am
I've held the domain for a few years. I am not going to renew it. If you'd like to take it over, please let me know immediately and I'll send you an unlock code so you can transfer it. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

ARRAY'14 Call for Papers

General haskell list - Thu, 01/23/2014 - 9:50pm
ARRAY 14: ACM SIGPLAN International Workshop on Libraries, Languages and Compilers for Array Programming Co-located with PLDI 2014, Edinburgh, UK. A full-day workshop on Friday June 13th, following the main conference. http://www.sable.mcgill.ca/array/ A new workshop on Libraries, Languages and Compilers for Array Programming will have its first instance with PLDI this year (on June 13 in Edinburgh). The workshop aims to bring together the various groups (including functional programmers) that work on array programming. Papers from readers of this mailing list would be very welcome. The deadline for submission of four to six-page research or tool papers is April 2nd 2014, with notification on April 18th. Note the SIGPLAN sponsorship and the fact that students can apply for SIGPLAN PAC funding. It will be a fun workshop! For more information see http://www.sable.mcgill.ca/array/ and think about submitting! Mary Sheeran (with Laurie Hendren (Chair), Alex Rubinsteyn and Jan Vitek) ____
Categories: Incoming News

xkcd - Haskell

Haskell on Reddit - Thu, 01/23/2014 - 9:01pm
Categories: Incoming News