Visitar URL original
Get rid of ImplicitParams to support MicroHs? · Issue #462 · UnkindPartition/tasty · GitHub
Skip to content

Get rid of ImplicitParams to support MicroHs? #462

Open

Description

@Bodigrim

tasty makes use of {-# LANGUAGE ImplicitParams #-} and not only for internal purposes, but also in the public API such as

-- @since 0.11.3
printStatistics :: (?colors :: Bool) => Statistics -> Time -> IO ()

Yet according to augustss/MicroHs#352 MicroHs is unlikely to support {-# LANGUAGE ImplicitParams #-}. I'm not a big fan of this extension myself, but even if we were in agreement to rip it off, it cannot be done without breaking the public API and bumping the major version. Which is not exactly the end of the world, but lots of busy work for downstream.

We can potentially comment out implicit parameters when compiled with MicroHs. Not great if in future MicroHs changes the decision and starts supporting them though.


Another option is to add

flag has_implicit_params
  default: True 

and then

if flag(support_implicit_params)
  other-extensions: ImplicitParams
  cpp-options: -DHasImplicitParams

and then

#ifdef HasImplicitParams
type HasColors = (?colors :: Bool)
#else 
type HasColors = ()
#endif 

This does not hard-code any knowledge about capabilities of MicroHs and ideally Cabal should be able to solve for the flag automatically. If in future MicroHs starts supporting ImplicitParams, all will work out automatically.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions