Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation issues when loading custom BootTidal.hs #29

Closed
ericfairbanks opened this issue Jan 23, 2018 · 3 comments · Fixed by #52
Closed

Indentation issues when loading custom BootTidal.hs #29

ericfairbanks opened this issue Jan 23, 2018 · 3 comments · Fixed by #52

Comments

@ericfairbanks
Copy link

If it put this (as far as I can tell) perfectly valid bit of Haskell in my BootTidal.hs, GHCI complains about indentation or mismatched bracket issues. I've tried re-arranging my functions in a variety of ways, but the only things it seems to accept are one-liners.

describeLetter :: Char -> String
describeLetter c =
    if c >= 'a' && c <= 'z'
        then "Lower case"
        else if c >= 'A' && c <= 'Z'
            then "Upper case"
            else "Not an ASCII letter"
@digitalohm
Copy link

digitalohm commented Apr 5, 2018

same problem here in trying to put the following into boot.tidal :(

let startclock d p = do
                  now <- getNow
                  d $ (pure (nextSam now)) ~> p

oneshot d p = startclock d $ seqP [(0, 1, p)]

@kindohm
Copy link

kindohm commented May 27, 2018

This won't work - Tidal boot files are split into single lines and each line is sent to GHCI individually. The BootTidal.hs file really isn't valid Haskell code. It might as well be a .txt file.

Going all the way back to the original Emacs tidal.el file I think this is just how it's always been done. A bad reason, I know. I suppose the package could be improved to parse the file first and detect whitespace and empty lines and try to smartly send larger blocks to GHCI other than single lines. Anyone interested in trying to solve that?

@ndr-brt
Copy link
Collaborator

ndr-brt commented Sep 30, 2019

If it put this (as far as I can tell) perfectly valid bit of Haskell in my BootTidal.hs, GHCI complains about indentation or mismatched bracket issues. I've tried re-arranging my functions in a variety of ways, but the only things it seems to accept are one-liners.

describeLetter :: Char -> String
describeLetter c =
    if c >= 'a' && c <= 'z'
        then "Lower case"
        else if c >= 'A' && c <= 'Z'
            then "Upper case"
            else "Not an ASCII letter"

You should wrap multiline code like this:

:{
describeLetter :: Char -> String
describeLetter c =
    if c >= 'a' && c <= 'z'
        then "Lower case"
        else if c >= 'A' && c <= 'Z'
            then "Upper case"
            else "Not an ASCII letter"
:}

And it will work correctly

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 a pull request may close this issue.

4 participants