records 0.1.1.2 → 0.1.1.3
raw patch · 3 files changed
+29/−29 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- records.cabal +1/−1
- src/Data/Record.hs +14/−14
- src/Data/Record/Combinators.hs +14/−14
records.cabal view
@@ -1,5 +1,5 @@ Name: records-Version: 0.1.1.2+Version: 0.1.1.3 Cabal-Version: >= 1.2.3 Build-Type: Simple License: BSD3
src/Data/Record.hs view
@@ -33,9 +33,9 @@ consist of an initial record and a last field each). For example, the following expression denotes a record that contains some information about the author of these lines: - @- X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\"- @+@+X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\"+@ The type of a record has the form @/r/ /s/@ where @/r/@ is a record scheme and @/s/@ is a representation of a type-level function, called the record style. A record@@ -47,9 +47,9 @@ style to the sort yields the type of the corresponding field value. For example, the above record has the following type: - @- (X :& Surname ::: String :& Age ::: Int :& Room ::: String) ('Id' 'KindStar')- @+@+(X :& Surname ::: String :& Age ::: Int :& Room ::: String) ('Id' 'KindStar')+@ If we replace the type @Id KindStar@ by @Id KindStar :-> Id KindStar@, we get a type that covers all records with a @Surname@, an @Age@, and a @Room@ field that contain values of@@ -105,19 +105,19 @@ The class of name types. For each field name @/N/@, there should be a declaration of the following form: - @- data /N/ = /N/ deriving (Show)- @+@+data /N/ = /N/ deriving (Show)+@ That way, the name can be represented in types by the type constructor @/N/@, and in expressions and patterns by the data constructor @/N/@. Furthermore, the following instance declaration should be added: - @- instance Name /N/ where-  - name = /N/- @+@+instance Name /N/ where+ + name = /N/+@ Such instance declarations allow record combinators to construct value-level representations of names from type-level representations.
src/Data/Record/Combinators.hs view
@@ -52,29 +52,29 @@ Fixes the style of a record. When a record is constructed using @X@, @(:&)@, and @(:=)@, the style of this record is not fixed. For example, the most general type of the record - @- X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\"- @+@+X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\"+@ is - @- ('App' style sortSurname ~ String, Num ('App' style sortAge), 'App' style sortRoom ~ String) =>- (X :& Surname ::: sortSurname :& Age ::: sortAge :& Room ::: sortRoom) style- @+@+('App' style sortSurname ~ String, Num ('App' style sortAge), 'App' style sortRoom ~ String) =>+(X :& Surname ::: sortSurname :& Age ::: sortAge :& Room ::: sortRoom) style+@ We can fix the style of that record using the expression - @- X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\" \`withStyle\` 'Id' 'KindStar'- @+@+X :& Surname := \"Jeltsch\" :& Age := 33 :& Room := \"HG/2.39\" \`withStyle\` 'Id' 'KindStar'+@ which has the most general type - @- (Num age) =>- (X :& Surname ::: String :& Age ::: age :& Room ::: String) ('Id' 'KindStar')- @+@+(Num age) =>+(X :& Surname ::: String :& Age ::: age :& Room ::: String) ('Id' 'KindStar')+@ The @withStyle@ combinator is similar to 'asTypeOf'. -}