homepage: ''
changelog-type: markdown
hash: 54304b6552aceaa0288cb80af998575083cef01514536026e91896e027528620
test-bench-deps:
  Cabal: ! '>=2.4.1.0 && <2.5'
  base: ! '>=4.7 && <5'
  hspec: ! '>=2.7.1 && <3'
  first-class-instances: -any
  containers: ! '>=0.6.0.1 && <0.7'
  hspec-discover: ! '>=2.7.1 && <3'
  template-haskell: ==2.14.*
maintainer: matten@tuta.io
synopsis: First class typeclass instances
changelog: |
  # Changelog for first-class-instances

  ## Unreleased changes
basic-deps:
  Cabal: ! '>=2.4.1.0 && <2.5'
  base: ! '>=4.7 && <5'
  containers: ! '>=0.6.0.1 && <0.7'
  template-haskell: ==2.14.*
all-versions:
- 0.1.0.0
author: Matej Nižník
latest: 0.1.0.0
description-type: markdown
description: |-
  # first-class-instances

  (Work in progress!)

  Remember when you had some neat way of building instance out of another one,
  when some type had multiple interesting instances of the same class, or when it
  was possible to elegantly derive some instance for your type on paper, but
  compiler just wouldn't let you to use these things because of overlapping and stuff?
  Well, now you can!:

  ```hs
  class Monad m => Teletype m where
    read  :: m String
    write :: String -> m ()

  mkInst ''Teletype

  hello :: Teletype m => m ()
  hello = do
    write "What's your name?: "
    name <- read
    write $ "Hi " ++ name ++ "!\n"

  main :: IO ()
  main = Teletype inst getLine putStr ==> hello
  ```

  `first-class-instances` allow you to treat typeclass instances as what they
  actually are - ordinary values. And Magic Inside™ turns them back and forth
  between ordinary constraints when needed. Build instances from the others,
  locally from available functions or even dynamically at runtime! Or derive them
  using ordinary Haskell code and then promote into global ones using TH (TODO).

  This library is still experimental, so please do not use it for serious things,
  but I welcome you to try it out and give some feedback!
license-name: BSD-3-Clause

Update from Hackage at 2020-02-02T17:45:53Z
Update from Hackage at 2020-02-02T17:45:53Z
