Im trying to get some type-level logic to implement anonymous "flat" sums. I can't figure out how to deal with recursive matching cases though. Something like this compilers, but it doesn't work as well as it shouldclass Remove (l :: [*]) (t :: *) (ll :: [*]) | l t -> ll instance (x ~ t) => Remove (x ': l) t l instance Rem l t ll => Remove (x ': l) t (x ': ll)
What I'd really like is something like a direct translation of the normal list functiontype family Remove (l :: [*]) (t :: *) :: [*] type instance Remove (t ': l) t = l type instance Remove (x ': l) t = x ': Remove l t
but GHC complains about conflicting family instances. Similarly for other list functions like elem. Is there any way massage the compiler into accepting?submitted by dogirardo
[link] [1 comment]
So, I finished reading Learn You a Haskell (http://learnyouahaskell.com/) and now I need book number two.
I am now taking recommendations: I'd like a book specifically that covers comonads and lens. Anybody know a good second Haskell book to read after your first?
Edit: wow, it's really nice to see I got a lot recommendations for this. I'm very proud to be learning haskell, there's a very positive community behind it no doubt.submitted by alphonse23
[link] [24 comments]
Disclaimer: crossposted on StackOverflow.
The problem I'm running into is that, when I run the parse, I get a bunch of infix operators parsed as UInfixE and UInfixP, meaning that they are of unresolved associativity.
The description of the associativity talks about how the Haskell compiler resolves these.
I'm wondering, is there a function avaliable which can do this reassociation on the trees I get from parsing? I'm looking for something like this:reassoc :: [Dec] -> [Dec]
I could write the massive AST traversal that does this, but it seems like it would be a massive amount of boilerplate, and clearly the function already exists in some form (hopefully in a form that plays nice with TH).
Does such a thing exist? Is there an easy way to get rid of unresolved infix operators in the AST I get from parsing declarations?
Even a function which, given the Name of an operator, could give its precedence and associativity, would be very useful.submitted by jmite
I want to write a really simple intractable physics simulation, and I can't for the life of me find a game engine (really meaning a graphics library with mouse and keyboard functionality). Does anyone know of a good one?submitted by Undo_all
[link] [38 comments]
I created my first package and would like to know if I'm doing things right. Everything from specifying the dependency versions correctly, to documentation tips, to missing cabal file information.
Also there's a good chance I should be using lenses or something to do the kinds of transformations that this library provides. I'm still kind of a beginner.submitted by begriffs
Welcome to the weekly GHC news. This one will be short this week, as the preceding one occurred only on Monday - but we'll be going with Fridays from now on, so next week we'll hopefully see a longer list.
- GHC 7.8.4 tickets have been in waiting, and the RC will be soon after Austin finishes some final merges and tests on his branch. We have not committed a time for the release after the RC, yet we would like people to please seriously test and immediately report any major showstoppers - or alert us of ones we missed.
- For the GHC 7.10 release, one of the major features we planned to try and merge was DWARF debugging information. This is actually a small component of larger ongoing work, including adding stack traces to Haskell executables. While, unfortunately, not all the work can be merged, we talked with Peter, and made a plan: our hope is to get Phab:D169 merged, which lays all the groundwork, followed by DWARF debugging information in the code generators. This will allow tools like gdb or other extensible debuggers to analyze C-- IR accurately for compiled executables. Peter has written up a wiki page, available at SourceNotes, describing the design. We hope to land all the core infrastructure in Phab:D169 soon, followed by DWARF information for the Native Code Generator, all for 7.10.1
- This past week, a discussion sort of organically started on the #ghc IRC channel about the future of the LLVM backend. GHC's backend is buggy, has no control over LLVM versions, and breaks frequently with new versions. This all significantly impacts users, and relegates the backend to a second class citizen. After some discussion, Austin wrote up a proposal for a improved backend, and wrangled several other people to help. The current plan is to try an execute this by GHC 7.12, with the goal of making the LLVM backend Tier 1 for major supported platforms.
- You may notice https://ghc.haskell.org is now responds slightly faster in some cases - we've activated a caching layer (CloudFlare) on the site, so hopefully things should be a little more smooth.
This is my expression tree and related combinators https://github.com/phaazon/ash/blob/master/src/Ash.hs.
I’d like to type it in order to typecheck at compile time so that I can’t, for instance, right an addition of a floating value and an integral value. With the current implementation, I use a nasty L (for litteral) data to represent typed values at runtime, which sucks to me since I have to write a function typecheck :: E a -> Maybe TypeError.
Any idea?submitted by _skp
[link] [11 comments]
I have been a Haskell enthusiast for a while now, but haven't seriously committed to it on any large projects.
The combination of these things leads to this feeling:
- Though Haskell is used in some production settings, it doesn't have nearly the amount of use as the other languages/platforms I use.
- Sometimes things feel too easy. Like the fact that I don't have a thousand lines of framework setup and configuration. Or that I can just blindly put together things by their types and have them work.
- I don't really know what I would do if I ever did have a big problem, especially if this was for my individual business ventures (that is, no buckets of money to throw at the problem).
I am able to create software more easily, and it seems much more reliable, and this worries me.
Are these completely unfounded?submitted by fear-of-flying
[link] [34 comments]