Skip to content

BinderDavid/tuple-fields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tuple-fields

CI

Accessing tuple fields in Haskell using record dot syntax.

Adds (orphan) typeclass instances of the following form for all tuples up to 62-tuples:

instance HasField "_1" (a1,a2,a3) a1 where
  getField (x,_,_) = x

instance HasField "_2" (a1,a2,a3) a2 where
  getField (_,x,_) = x

instance HasField "_3" (a1,a2,a3) a3 where
  getField (_,_,x) = x

This allows access to all fields using record dot syntax:

(true, "hello", 42)._1 == true
(true, "hello", 42)._2 == "hello"
(true, "hello", 42)._3 == 42

About

Accessing tuple fields in Haskell using record dot syntax.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published