Skip to content

Commit

Permalink
autoTC
Browse files Browse the repository at this point in the history
  • Loading branch information
mstksg committed Aug 24, 2019
1 parent 15e2f1f commit e5ca897
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.stack-work/
decidable.cabal
*~
.ghc.environment*
dist-newstyle/
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

Version 0.2.1.0
---------------

*August 24, 2019*

<https://github.com/mstksg/decidable/releases/tag/v0.2.1.0>

* Add `autoTC` for convenient usage of `auto` with type constructors.

Version 0.2.0.0
---------------

Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: decidable
version: 0.2.0.0
version: 0.2.1.0
github: "mstksg/decidable"
license: BSD3
author: "Justin Le"
Expand Down
14 changes: 11 additions & 3 deletions src/Data/Type/Predicate/Auto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
module Data.Type.Predicate.Auto (
-- * Automatically generate witnesses at compile-time
Auto(..)
, AutoNot, autoNot
, autoTC
, AutoNot
, autoNot
, autoAny, autoNotAll
, AutoProvable
-- ** Helper classes
, AutoElem(..)
, AutoAll(..)
-- * Auto with help
, autoAny, autoNotAll
) where

import Data.Functor.Identity
Expand Down Expand Up @@ -84,6 +85,13 @@ class Auto (p :: Predicate k) (a :: k) where
-- @
auto :: p @@ a

-- | A version of 'auto' that "just works" with type inference, if the
-- predicate is a type constructor.
--
-- @since 0.2.1.0
autoTC :: forall t a. Auto (TyPred t) a => t a
autoTC = auto @_ @(TyPred t) @a

instance SingI a => Auto Evident a where
auto = sing

Expand Down

0 comments on commit e5ca897

Please sign in to comment.