News aggregator

Haskell Report Infelicity?

haskell-cafe - Mon, 10/26/2015 - 9:49pm
I have probably misunderstood but is the following expected? floor, round, truncate and ceiling give similar results (all methods of the RealFrac class). properFraction :: (Integral b, RealFrac a) => a -> (b, a) *Girsanov> properFraction (-1 / 0) (-17976931348623159077293051907890247336179769789423065727343008115773267 5805500963132708477322407536021120113879871393357658789768814416622492847 4306394741243777678934248654852763022196012460941194530829520850057688381 5068234246288147391311054082723716335051068458629823994724593847971630483 5356329624224137216,0.0) *Girsanov> properFraction (1 / 0) (179769313486231590772930519078902473361797697894230657273430081157732675 8055009631327084773224075360211201138798713933576587897688144166224928474 3063947412437776789342486548527630221960124609411945308295208500576883815 0682342462881473913110540827237163350510684586298239947245938479716304835 356329624224137216,0.0) *Girsanov> properFraction (0 / 0) (-269653970229347386159395778618353710042696546841345985910145121
Categories: Offsite Discussion

Munich Haskell Meeting, 2015-10-29 < at > 19:30

haskell-cafe - Mon, 10/26/2015 - 9:45pm
Dear all, This week, our monthly Munich Haskell Meeting will take place again on Thursday, October 29 at Cafe Puck at 19h30. For details see here: http://chneukirchen.github.io/haskell-munich.de/dates (http://www.haskell-munich.de/ is currently out of order, but will be restored soon! I hope...) 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-oct-2015/ Everybody is welcome! cu,
Categories: Offsite Discussion

Proposal: Forbidden Instances

Haskell on Reddit - Mon, 10/26/2015 - 5:05pm

Hi /r/haskell,

tl;dr: Provide a way to selectively forbid instances like Foldable Maybe, Foldable (,)a,), etc in GHC to help people that have problems with the FTP.

The following proposal is an idea that I had when I was following the discussions about the FTP in spring. I did not manage to write something down then, but as there are still discussions going on about the (now implemented) FTP (e.g. here, here, and here, and, somewhat related, here), my proposal might still be useful. (Please correct and excuse me if this is not the case)

I think I can boil down my personal problems with the FTP to the following issue: In my mental model, functions like length and forM only make sense for "containers". Also, again in my personal model, common types like Maybe a or (String, a) are not considered to be "containers" for a; Maybe a is the result type of a partial function that returns as and (String, a) is the result type of a function that returns as and Strings. So, in my code, when I write something like

length someValue

where someValue has the type Maybe a, this is a stupid mistake... I actually intended to write:

fmap length someValue

or

fromMaybe 0 . fmap length $ someValue

or similar things.

Unfortunately, I do these kind of mistakes often (which is why I have big problems with dynamically typed languages) and it is a real productivity improvement if they are caught by the type checker. But I also recognize that for other people's mental model, functions like length might have a more abstract meaning.

So here's my proposal: implement a directive in GHC that allows to forbid the type class resolver (meaning the component that inserts the dictionaries) to use particular type-class instances, even though they are imported. For example, I could then write

import Data.Foldable forbid instance Foldable Maybe

at the beginning of my modules (or something equivalent in my .cabal file) and GHC will not be able to compile length (someValue :: Maybe a), as the Foldable instance is forbidden. But, I could still use the imported Foldable API for what I consider "real" containers.

Note that this is not instance hiding; if an instance is forbidden it also should not be possible to redefine it. Thus this feature should not endanger the "there is globally only one instance"-property.

I think a (presumably) modest and easy to implement feature like this would go a long way to reconcile Haskell programmers like me that feel the FTP actually reduces the usefulness of the Haskell type system in their programming tasks (of course assuming I'm not the only one feeling that way). So what do you think? Is this sketch worth pursuing, i.e. fleshing it out as a real proposal? Do I overlook major problems? (Or was something like this already discussed and dismissed?)

Thanks for listening :)

submitted by mstrlu
[link] [30 comments]
Categories: Incoming News

Neil Mitchell: FilePaths are subtle, symlinks are hard

Planet Haskell - Mon, 10/26/2015 - 3:03pm

Summary: When thinking about the filepath .., remember symlinks, or you will trip yourself up.

As the maintainer of the Haskell filepath package, one common path-related mistake I see is the assumption that filepaths have the invariant:

/bob/home/../cookies == /bob/cookies

I can see the conceptual appeal - go down one directory, go up one directory, end up where you started. Unfortunately, it's not true. Consider the case where home is a symlink to tony/home. Now, applying the symlink leaves us with the case:

/tony/home/../cookies == /bob/cookies

And, assuming /tony/home is itself not a symlink, that reduces to:

/tony/cookies == /bob/cookies

This is clearly incorrect (assuming no symlinks), so the original invariant was also incorrect, and cannot be relied upon in general. The subtle bit is that descending into a directory might move somewhere else, so it's not an operation that can be undone with ... Each step of the path is interpreted based on where it ends up, not based on the path it took to the current point.

While this property isn't true in general, there are many special cases where it is reasonable to assume. For example, the shake package contains a normaliseEx function that normalises under this assumption, but nothing in the standard filepath package assumes it.

The full example
/
[DIR] bob
[DIR] tony
/bob
[LINK] home -> /tony/home
[FILE] cookies
/tony
[DIR] home
/tony/home
[FILE] cookies
Categories: Offsite Blogs

Roman Cheplyaka: Static linking with ghc

Planet Haskell - Mon, 10/26/2015 - 2:00pm

Recently I needed to build a Haskell program that would run on my DigitalOcean box. The problem was that my laptop’s Linux distro (Fedora 22) was different from my server’s distro (Debian jessie), and they had different versions of shared libraries.

I could build my app directly on the server, but I decided to go with static linking instead. I didn’t find a lot of information about static linking with ghc on the internet, hence this article.

First, let’s clarify something. There are two kinds of libraries any Haskell program links against: Haskell libraries and non-Haskell (most often, C) libraries. Haskell libraries are linked statically by default; we don’t need to worry about them. ghc’s -static and -dynamic flag affect that kind of linking.

On the other hand, non-Haskell libraries are linked dynamically by default. To change that, we need to pass the following options to ghc:

-optl-static -optl-pthread

If you are using stack (as I did), the whole command becomes

stack build --ghc-options='-optl-static -optl-pthread' --force-dirty

--force-dirty may be needed because stack may not recognize the options change as a sufficient reason to re-run ghc; this may get fixed in future versions of stack.

The command may fail in case you don’t have some of the static libraries installed. In my case, the dynamic version of the executable had these dynamic dependencies (as reported by ldd):

linux-vdso.so.1 (0x00007ffcb20c2000) librt.so.1 => /lib64/librt.so.1 (0x00007fa435dc6000) libutil.so.1 => /lib64/libutil.so.1 (0x00007fa435bc3000) libdl.so.2 => /lib64/libdl.so.2 (0x00007fa4359be000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fa43574e000) libgmp.so.10 => /lib64/libgmp.so.10 (0x00007fa4354d6000) libm.so.6 => /lib64/libm.so.6 (0x00007fa4351cd000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fa434fb6000) libc.so.6 => /lib64/libc.so.6 (0x00007fa434bf6000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa4349d9000) /lib64/ld-linux-x86-64.so.2 (0x000055571e53e000)

To satisfy them statically, I had to install only three Fedora packages:

pcre-static.x86_64 gmp-static.x86_64 glibc-static.x86_64
Categories: Offsite Blogs

First library written, EasyBitcoin, looking for feedback.

Haskell on Reddit - Mon, 10/26/2015 - 12:43pm

http://hackage.haskell.org/package/easy-bitcoin

This is the first time I've published something on Hackage, always wanted to do it, but was afraid about it. As its name says, it is a library about bitcoin, it started as a fork of Haskoin, trying to simplify its API. If interested, I've made an small tutorial about how to write a command line wallet .

It is both, my first library and my first blog post, so I'd rather appreciate your feedback!

Thanks, indeed :)

submitted by sofosure
[link] [13 comments]
Categories: Incoming News

Learning Haskell: Tetris game

Haskell on Reddit - Mon, 10/26/2015 - 12:12pm
Categories: Incoming News

best practice for lifting of IO and could lifting beautomated?

haskell-cafe - Mon, 10/26/2015 - 12:03pm
Dimitri DeFigueiredo wrote: For this particular example, the answer is easy: If you have the IO monads, you have the Reader monad, and the State/Writer as well. This is just an IORef. Using just IO, you can get State, Reader, Writer, and Exception (and in a modular way!) As to you general question, I will and do advocating abandoning monad transformers altogether. The paper on extensible effects demonstrated a new solution to the MonadCatchIO problem that solved the long-standing issue of discarding state upon exception. See Sec 6 of http://okmij.org/ftp/Haskell/extensible/more.pdf
Categories: Offsite Discussion

Five more days: Call for Contributions: BOB 2016 - Berlin, Feb 19, 2016

haskell-cafe - Mon, 10/26/2015 - 11:11am
The submission deadline for is five days away. We are happy with the submissions so far, but you can always have more. So if you always wanted to look into some library that everybody is fussing about and then tell people what you learned, or if you have this trick or you wrote that piece of code that you are fond of, please take a minute to check out our submission guidelines this week. http://bobkonf.de/2016/cfp (We have speaker grants for under-represented groups.) cheers, m.
Categories: Offsite Discussion

FP Lunch: Creating Personal Ambitions

Planet Haskell - Mon, 10/26/2015 - 9:10am

Most of us become paralyzed by concern when it comes to truly treading out and doing something about our aspiration. The life we wish is visualized by us, we find out about our people carrying it out and think that somehow they’re extra ordinary or involve some super-human power that makes them in a position to live our aspiration out. The fact remains which they simply began going. There are certainly a lot of individuals who like to compose and want notify to stimulate or educate their given industry on their unique attention. These folks actually cease themselves possibly dreaming about doing this for a living since they just cant work out how to get there using their existence. Their lifestyle meaning Oh Ive got youngsters to look after, oh I better get my doctorate degree first, oh Im not fairly enough, oh I dont learn the first in regards to the writing industry. These arent sensible explanations why you cant become a productive published author, these are simply reasons.

Your sign your sign is also named your “rising indicator.” the 2 phrases are interchangeable.

There are effective authors all over the world who arent any prettier, smarter, thicker, or maybe more exclusive than you’re, they are only doers and not just dreamers. Should you would consider oneself a dreamer then you definitely must become a doer! This is actually the self-published author’s evening. Becoming a home- printed writer will be the method you’ll be able to begin and develop a book publishing profession that is productive and lucrative. More and more people so are taking control in their future and are canning their ideas of pursuing traditional book publishing deals and getting self- released experts. You can study a lot of distinct companies that can help you receive your guide printed. I recommend choosing a company that has a simple deal, a simple writing offer which includes most of the thing you need to have a functional, world class book plus one that could give superior discussion on marketing your book to you.

Melanoma guys are unbelievable lovers.

There are various approaches to market your guide and a marketing plan that suits your lifestyle can be definitely developed by you. For example, if you’re a property mommy and you are an expert in health and you need to start to inform people through creating your own book, you are able to produce a book promotional approach that’s more web than basically traveling a lot doing workshops and book signings. My book would be published by me with a firm which was at least able to support me develop a marketing plan if I needed since 90% to become an effective writer of the work may be the marketing and marketing that aid. But dont permit this shock you. If you would like to achieve your dream of being a published publisher then consult with somebody who can provide you on publishing the top & most valuable guide feasible direction and do some investigation about the marketplace and maybe custom essays for sale you just need to consider step one.

Categories: Offsite Blogs

I made a strange visual functional debugger for my minor thesis. Please try it out!

Haskell on Reddit - Mon, 10/26/2015 - 6:45am

TLDR: I have a rather unique debugging task/survey up at http://calc.run, that I'm looking for people to try out.

I'm doing a minor thesis at my university exploring an alternate method of debugging purely functional programs. Computations are represented spatially, with the user being able to incrementally reveal the details of a computation to view all of the intermediate computations taking place.

The project was motivated by my frustrations debugging in Haskell. The tool doesn't actually debug Haskell code though, because in order to implement the tool I essentially had to write my own interpreter for an intermediary language. What I'm actually doing at the moment is transpiling from the compiled JS of a PureScript program to my own format. It's quite a messy beast underneath, but it's intended as a prototype. You don't need to know anything about PureScript, because the original source code is never shown.

I need people to run through a few debugging tasks so I can observe how people use the tool, and what they think about it. It should take about 30 minutes. If you can spare the time to check it out, it would be much appreciated:

http://calc.run

Edit: also, if for some reason the survey bugs out on you, please let me know. I'm a novice to web dev! Thanks :)

submitted by -ecl3ctic-
[link] [23 comments]
Categories: Incoming News

mashup of Haskell News and hdiff

haskell-cafe - Mon, 10/26/2015 - 5:17am
Hi all, For Haskell News junkies I created a simple mashup of haskellnews.org and Luite Stegeman's hdiff site. It adds a "hdiff" link to all Hackage upload news items so you can conveniently see what changed in the new version. It consists of just an html file and .js file and is available at: https://github.com/erantapaa/haskellnews-hdiff ER _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Hackage feature request: show types of names listedin index page

haskell-cafe - Mon, 10/26/2015 - 2:29am
I pretty much said all I wanted to say in the title, but just to rephrase, I think it'd be super helpful if Hackage listed types of names listed in index pages. The reason is because most of the time I'm using index pages for searching things, but if I wanted to list all functions that somehow use a type, for example, index pages don't help. With type information in the index pages I can just search for a type and my browser would highlight all functions that somehow use the type.
Categories: Offsite Discussion

FP Complete: The new haskell-ide repo

Planet Haskell - Sun, 10/25/2015 - 11:00pm

Recently Alan Zimmerman announced on the haskell-cafe mailing list that there was a new haskell-ide project, with a new Github repository, a mailing list and an IRC channel. Some people have been concerned that this effort is fragmenting existing efforts, including with ide-backend (the open sourced library FP Complete announced earlier this year). I clarified this on Reddit, but wanted to take the opportunity to do so on this blog as well (and, additionally, throw some extra attention on the haskell-ide project).

Alan's announcement did not come in a vacuum; about two weeks ago, he reached out to others for feedback on a potential project. There were some side channel discussions that I was involved in, all of which were very much in favor of (and excited about!) this project. To quote myself from Reddit, we reached the following conclusion:

Both the ghc-mod and ide-backend maintainers have agreed to contribute code to this new repository and then rebase the old repos on this. The reason we're using a new repo instead of modifying one of the existing ones is so that the existing projects experience no disruption during this migration process. If this was a new set of people starting a new project without support from existing projects, I'd agree with you. But Alan's reached out to existing players already, which is an important distinction.

Michael Sloan - the current maintainer of ide-backend and one of the primary developers of both School of Haskell and FP Haskell Center - is already getting involved in this project. It's too early to decide exactly what the future of ide-backend will be relative to haskell-ide, but we're not ruling anything out. Anything from rebasing ide-backend to use haskell-ide internally, all the way to deprecating ide-backend in favor of haskell-ide, is on the table. We'll do whatever makes the most sense to help the Haskell community create great tooling.

Related to this project: a number of people have been following the development of stack-ide. We started that project not realizing how quickly existing tooling (like ghc-mod and hdevtools) would adopt support for Stack, and certainly not expecting this new haskell-ide project to offer a unifying force in the Haskell tooling space. To avoid fragmentation, we're currently holding off on further word on stack-ide, hoping instead that collaboration will help improve existing tooling not just for the Stack use case, but for cabal, cabal sandboxes, and other cases people have been targeting.

Since I'm already discussing IDE stuff, let me publicly give an answer I've given privately to a few people. A number of individuals have asked about the future of the FP Haskell Center codebase, and the possibility of open sourcing it. The summary answer is:

  • Everything related to School of Haskell is being open sourced. Most of that is done already, the rest is just in the last few stages of code cleanup.
  • The current state of the FP Haskell Center code base is difficult to simply give out, since it's based on some superseded technologies. For example, we created it in a world where Docker didn't exist, and have quite a few LXC scripts to make it work. We also have some difficult-to-manage build scripts that could be replaced by Stack. We've cleaned all of this up for School of Haskell, but have not done the same to the FP Haskell Center codebase.
  • As a general policy, we don't like to just drop unsupported code on the community at FP Complete. If there are maintainers that are interested in taking over the current FPHC codebase, we can discuss transferring it over. But simply open sourcing without any support tends not to be a helpful move (instead, it distracts from other, active projects, which we don't want to do).
  • One possibility going forward is that, once the School of Haskell web service is up, running, and stable, a new IDE project could be started that targets that same API. We're not planning on running such a project at FP Complete, but we'd be happy to provide some feedback, and include necessary changes to the SoH service to make it work.

I hope this excites others as much as it excites me: some concerted efforts on improving tooling can hopefully go a long way. A big thank you to Alan for coordinating this effort, and to Michael Sloan for leading the charge from the FP Complete side. I'm optimistic that we'll see some real strides forward in the near future.

Categories: Offsite Blogs

Does Yesod have a console for playing with persistent models?

Haskell on Reddit - Sun, 10/25/2015 - 6:58pm

It's something I'd really like to use. I've found several posts about the possibility, e.g. the Yesod Wish List. But nothing concrete yet.

(I'm gathering this info for a web framework comparison matrix for my next project: https://docs.google.com/spreadsheets/d/1H13X4xmMw5YBD5nCp7tRXDD3gMEiFjbGXn3_Np7nozU/edit#gid=0 )

EDIT: Here's a screenshot of the Rails REPL showing what I'm talking about.

submitted by whither-the-dog
[link] [9 comments]
Categories: Incoming News

Christopher Done: Idle thoughts: More open, more free software

Planet Haskell - Sun, 10/25/2015 - 6:00pm

I’m a bit busy, these are just some idle thoughts.

I just upgraded my Android OS to some other kind of dessert name and a bunch of stuff changed in a way I had no desire for.

It made me think about the virtues of open source software. I can just go and change it! Free software means benefiting from the work of others without being shackled by them at the same time.

And then about the problems of open source software, which is that only developers-skilled developers-with specific knowledge, are able to approach the codebase of an app they use, update it, and then use that new software in a continuous and smooth way. Everyone else’s hands are effectively tied behind their backs.

So that got me thinking about how software could be more “open” than simply “open source”, if it was inherently more configurable. And also about better migration information from one piece of software to the next.

So I imagined a world in which when I get an update for a piece of software I could see a smart diff, as a regular human, of what the new UI and behaviour looks like, how it changed. This button moved there, changed color. Pressing this button used to exhibit X behaviour, now that behaviour is more complicated, or more limited, to trigger this action, and so on.

I believe that a properly declarative UI library with explicit state modeling, such as in Elm or whatnot, could actually handle a thing like that, but that it would have to be designed from the bottom up like that. And every component would need to have some “mock” meta-data about it, so that the migration tool could say “here’s what the old UI looks like with lorem ipsum data in it and here’s what that same data, migrated, looks like in the new UI” and you could interact with this fake UI on fake data, with no consequences. Or interact with the user’s data in a read-only “fake” way.

You could say: actually, no, I want to configure that this button will stay where it is, that the theme will stay my current dark theme, etc.

You could visualize state changes in the UI such as with the time traveling thing in Elm or React and make new decision trees, or perhaps pick between built-in behaviours.

But one key idea could be that when you update software in a new way, unless you’re removing the ability to do a feature completely (e.g. the server won’t even respond to that RPC call), then you should indicate that, in the intelligent “software diff”: then the user can say, no I still want to use that and now they have a “patched” or “forked” version of the software locally but that the maintainers of the software don’t have to worry about.

Normally configuring software is a thing developers manually hard code into the product. It seems obviously better to make software inherently configurable, from a free software perspective at least (not from a proprietary locked-in perspective).

Of course, you could write code at any time; drop down to that. But if most of the code can be self-describing at least in a high-level “do the thing or that thing” way, this would be far more accessible to general users than code itself which at the moment is magic and certainly beyond my interest to go and patch for the most part.

Categories: Offsite Blogs