Tidal
Tidal copied to clipboard
declare strict constructor arguments - instead of trying to deepseq later
(related: #606 https://github.com/rd--/hosc/pull/2#issuecomment-639522092)
If we do know that we never want lazy values - then we should declare strict constructor arguments. This is much better than sprinkling the code with rdeepseq later.
This states the intent, clearly, and in the right place (when we define the type), and it will check it automatically, every time, as early as possible (when the constructor is called).
By default, this should apply to
- all data types that have
NFDatainstances (currently,ArcF,Context,Value,Pattern) - all data types (e.g.,
Tempo,State,Config,EventF)? The latter could be achieved by pragmaStrictDatahttps://gitlab.haskell.org/ghc/ghc/-/wikis/strict-pragma I will give this a try.
What would be the remaining non-strict data? I think
- Pattern (because it contains a function)
- all prelude data types (List, Maybe)
Is there any part of the public API (Tidal's pattern combinators) that relies on laziness?
Is there any part of the public API (Tidal's pattern combinators) that relies on laziness?
No, is this short answer..
travis-CI tells me that StrictData is not available in ghc before 8.
If keeping compatibility with ghc-7 is important (for some folks it is, see this thread https://mail.haskell.org/pipermail/libraries/2020-May/030475.html )
then we have to put ! manually in data declarations.
Yes I think it would be best to keep support of older versions of ghc, if it's just a matter of adding some !s.
If it's important to keep support for ghc 7.x we can add a build on the ci
Centos 6 that is mentioned in that thread is no longer maintained. Ubuntu Xenial is still supported and is on ghc 7.10.3. It might be worth adding that.