Skip adjusting PATH if in noninteractive mode.
curl https://get-ghcup.haskell.org -sSf | BOOTSTRAP_HASKELL_NONINTERACTIVE=1 sh
works non-interactively until it gets to prompting to edit .bashrc or .bash_profile. I think this whole section should just be skipped in that case.