Re: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Alexis King
> On Mar 31, 2020, at 17:05, Sebastian Graf wrote: > > Yeah, SPEC is quite unreliable, because IIRC at some point it's either > consumed or irrelevant. But none of the combinators you mentioned should rely > on SpecConstr! They are all non-recursive, so the Simplifier will take care > of

RE: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Simon Peyton Jones via ghc-devs
Joachim: this conversation is triggering some hind-brain neurons related to exitification, or something like that. I recall that we discovered we could get some surprising fusion of recursive functions expressed as join points. Something like f . g . h where h loops for a while and

Re: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Sebastian Graf
> > This is a neat trick, though I’ve had trouble getting it to work reliably > in my experiments (even though I was using GHC.Types.SPEC). That said, I > also feel like I don’t understand the subtleties of SpecConstr very well, > so it could have been my fault. > Yeah, SPEC is quite unreliable,

Re: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Alexis King
Sebastian and Simon, Thank you both for your responses—they are all quite helpful! I agree with both of you that figuring out how to do this kind of specialization without any guidance from the programmer seems rather intractable. It’s too hard to divine where it would actually be beneficial,

Re: License for grammar

2020-03-31 Thread Carter Schonwald
Very cool! Mit / bsd 3 or bsd 2 or Apache are all reasonable On Tue, Mar 31, 2020 at 3:58 PM Евгений Слободкин wrote: > Hi all! > > I implemented Haskell grammar for ANTLRv4 based on HaskellReport 2010 > and GHC source (Parser.y and Lexer.x files). > > Link:

License for grammar

2020-03-31 Thread Евгений Слободкин
Hi all! I implemented Haskell grammar for ANTLRv4 based on HaskellReport 2010 and GHC source (Parser.y and Lexer.x files). Link: https://github.com/antlr/grammars-v4/blob/master/haskell/Haskell.g4 Could someone please help me figuring out which license this grammar should be published on?

Re: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Sebastian Graf
We can formulate SF as a classic Stream that needs an `a` to produce its next element of type `b` like this (SF2 below): {-# LANGUAGE BangPatterns #-} {-# LANGUAGE GADTs #-} module Lib where newtype SF a b = SF { runSF :: a -> (b, SF a b) } inc1 :: SF Int Int inc1 = SF $ \a -> let !b = a+1 in

RE: Fusing loops by specializing on functions with SpecConstr?

2020-03-31 Thread Simon Peyton Jones via ghc-devs
Wow – tricky stuff! I would never have thought of trying to optimise that program, but it’s fascinating that you get lots and lots of them from FRP. * Don’t lose this thread! Make a ticket, or a wiki page. If the former, put the main payload (including Alexis’s examples) into the