Skip to content

Fix indentation bug #1881#1913

Merged
paf31 merged 1 commit intopurescript:masterfrom
DavidLindbom:bugfix-1881
Mar 8, 2016
Merged

Fix indentation bug #1881#1913
paf31 merged 1 commit intopurescript:masterfrom
DavidLindbom:bugfix-1881

Conversation

@DavidLindbom
Copy link
Copy Markdown
Contributor

This should fix #1881 as indented behavior is a bit unclear.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 1, 2016

👍 Looks good, thanks!

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 2, 2016

Any thoughts on why CI is breaking?

@garyb
Copy link
Copy Markdown
Member

garyb commented Mar 2, 2016

Looking at the log, it's because there seem to be a ton of warnings like Redundant constraint: Functor m now. I guess that's new in ghc-8.0.0.20160229.

@hdgarrood
Copy link
Copy Markdown
Contributor

Unfortunately Monad only became a subclass of Applicative in base-4.8.0.0 (that is, GHC 7.10), so we'd have to drop support for GHC 7.6 and 7.8 if we wanted to remove those constraints. Or put CPP everywhere (yuck). Just using base-compat isn't enough, as it re-exports class definitions from base.

I guess the options are, modify the cabal file to ignore those warnings, or remove them and stop supporting GHC < 7.10. I'd vote to drop support for older GHCs, as I've found these warnings can be very useful.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 3, 2016

As long as we're using Stack to build (which I am now, for example, for the Mac binaries), then I'm fine with dropping < 7.10. Does the Linux64 binary build use Stack?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 8, 2016

I guess we can't build with GHC8 using Stack/Stackage right now.

I'd really like to have CI working again, so maybe disabling the GHC8 build makes the most sense for now.

@paf31 paf31 closed this Mar 8, 2016
@paf31 paf31 reopened this Mar 8, 2016
paf31 added a commit that referenced this pull request Mar 8, 2016
@paf31 paf31 merged commit 7fc9e1d into purescript:master Mar 8, 2016
@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 8, 2016

Thanks!

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 13, 2016

This actually breaks purescript-aff since the Par module has some incorrect indentation on line 50. We'll have to remember to fix that when we release this.

@texastoland
Copy link
Copy Markdown

This actually breaks purescript-aff

Milestone 0.9?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 13, 2016

Possibly, yes.

@DavidLindbom
Copy link
Copy Markdown
Contributor Author

Just to make sure, is it an error in the Par module or in the compiler. If it's in the module I can make a PR now to fix it.

@garyb
Copy link
Copy Markdown
Member

garyb commented Mar 13, 2016

Hmm, we try not to release breaking changes in the 0.x.y releases, maybe we'd be better off reverting this until 0.9? I'm not sure.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 13, 2016

I think aff is common enough that we should probably hold this off until 0.9. While it's not technically a breaking change, it is in the sense that we don't have a specification for indentation written down anywhere, so "it is what it does" right now 😄

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 13, 2016

@DavidLindbom I've reverted this, but if you'd like to reopen it, we can merge it in for 0.9.

Thanks!

@DavidLindbom
Copy link
Copy Markdown
Contributor Author

I can open it again but I just want to make sure first if this should be the correct behavior? More exact should that line in purescript-affbe disallowed or should I try to rework the patch?

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 20, 2016

I think aff needs to be changed either way, but it would probably be a major bump for both compiler and the package itself.

@garyb
Copy link
Copy Markdown
Member

garyb commented Mar 20, 2016

It wasn't immediately obvious to me what's wrong with the indentation, but I think I see it now:

 instance altPar :: Alt (Par e) where
  alt (Par a1) (Par a2) =
    let maybeKill va ve err =
      do e <- takeVar ve
         if e == 1 then killVar va err else return unit
         putVar ve (e + 1)
    in Par do
      va <- makeVar     -- the `a` value
      ve <- makeVar' 0  -- the error count (starts at 0)
      c1 <- forkAff $ attempt a1 >>= either (maybeKill va ve) (putVar va)
      c2 <- forkAff $ attempt a2 >>= either (maybeKill va ve) (putVar va)
      (takeVar va) `cancelWith` (c1 <> c2)

Should it be

    let
      maybeKill va ve err =
        do e <- takeVar ve
           if e == 1 then killVar va err else return unit
           putVar ve (e + 1)

instead? I happened to notice we have a do with indentation that way in the tests today, so I assume it's let related instead?

@texastoland
Copy link
Copy Markdown

Oh I missed it too that's exactly right! That was #1848.

@paf31
Copy link
Copy Markdown
Contributor

paf31 commented Mar 20, 2016

The first lexeme after let defines a new indentation level, and similarly for do. The issue is just that the do is to the left of the let (or the maybeKill is to the right of the let, depending on how you look at it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty function's body is parsed without error

5 participants