We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Commit 9099afbc authored by Camil Staps's avatar Camil Staps 🚀

Copy editing #201 (resolves #203)

parent eb4d0fa2
......@@ -338,17 +338,16 @@ bs_generic =
, syntax_code = ["generic ... ... [| ...] :: ... ", "derive ... ... [of ...] [with ...]"]
, syntax_description = "With generics, a function can be defined once and derived for (almost) all possible types, to avoid very similar code snippets."
, syntax_doc_locations = [CLR 9 "7.2" "_Toc311798069"]
, syntax_examples =
[ EX "generic gEq a :: !a !a -> Bool // The type of a generic function"
, EXs "macro" $ "gEq{|Int|} x y = x == y // Implementation of a generic\n" +
, syntax_examples = map EX
[ "generic gEq a :: !a !a -> Bool // The type of a generic function"
, "gEq{|Int|} x y = x == y // Implementation of a generic\n" +
"gEq{|PAIR|} fx fy (PAIR x1 y1) (PAIR x2 y2) = fx x1 x2 && fy y1 y2"
, EX "derive gEq [] // Deriving the gEq generic for type []"
, EXs "macro" "gConsName{|CONS of d|} _ = d.gcd_name // Using type information"
, EX "gFun{|CONS of {gcd_arity}|} // Using a specific field of type information, the compiler will only provide this field which makes it a lot faster"
, EXs "macro" $
"generic gFun a :: a -> Int | gDefault a // A generic function with a generic context. The context will become an argument.\n" +
"derive gFun CONS of {gcd_arity} with f _ // A derivation that does not use all arguments. The ompiler can optimize even more\n" +
"gFun{|CONS of {gcd_arity}|} f _ = // A derivation that does not use the context and only one field of the generic type descriptor, the compiler can optimize for this."
, "derive gEq [] // Deriving the gEq generic for type []"
, "gConsName{|CONS of d|} _ = d.gcd_name // Using type information"
, "gFun{|CONS of {gcd_arity}|} // Using a specific field of type information, the compiler will only provide this field which makes it a lot faster"
, "generic gFun a :: a -> Int | gDefault a // A generic function with a generic context. The context will become an argument.\n" +
"derive gFun CONS of {gcd_arity} with f _ // A derivation that does not use all arguments. The ompiler can optimize even more\n" +
"gFun{|CONS of {gcd_arity}|} f _ = // A derivation that does not use the context and only one field of the generic type descriptor, the compiler can optimize for this."
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment