1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Rework the constructors and eliminators a bit to not use tagged.

This commit is contained in:
Rob Rix 2016-06-16 16:41:43 -04:00
parent dcf9cdc6ae
commit ba1fc277eb
2 changed files with 2 additions and 7 deletions

View File

@ -61,7 +61,6 @@ library
, QuickCheck >= 2.8.1
, quickcheck-text
, semigroups
, tagged
, text >= 1.2.1.3
, text-icu
, these

View File

@ -1,7 +1,6 @@
{-# LANGUAGE DataKinds, FlexibleContexts, GADTs, GeneralizedNewtypeDeriving, KindSignatures, MultiParamTypeClasses, TypeOperators #-}
module Data.Record where
import Data.Tagged
import Prologue
-- | A type-safe, extensible record structure.
@ -21,16 +20,13 @@ infixr 0 .:.
infix 9 :=>
-- | A phantom type tag constructor.
newtype a :=> b = (:=>) (Tagged a b)
newtype a :=> b = Field { unField :: b }
-- | Smart constructor for type-tagged data fields.
-- |
-- | This has type a :=> b. When you require a to be some concrete type (and you usually will), it should be provided by context, whether using ascription, a type signature for the binding, `asTypeOf`, or some other way to allow the specific type to be inferred.
field :: b -> a :=> b
field = (:=>) . Tagged
unField :: a :=> b -> b
unField ((:=>) b) = unTagged b
field = Field
-- Classes