Copyright | (c) Tom Harding 2019 |
---|---|
License | MIT |
Maintainer | tom.harding@habito.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
class Record (structure :: Type) (f :: Type -> Type) (k :: Type) | f structure -> k where Source #
The record
function lets us supply arguments to a type
one by one, but can cause confusion when working with a record. If the
record contains two fields of the same type, for example, we've introduced
an opportunity for bugs and confusion. The record
function uses the
wonderful named
package to help us:
>>>
:set -XDeriveGeneric -XTypeApplications
>>>
:{
data User = User { name :: String, enemy :: String } deriving Generic :}
>>>
:{
test :: _ test = record @User :} ... ... Found type wildcard ... ... standing for ...("name" :! f [Char]) ... -> ("enemy" :! f [Char]) -> HKD User f... ...