Skip to content

Commit

Permalink
Add comment documenting mkGenericInstance parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
krame505 committed Mar 12, 2021
1 parent ff015ad commit 607b1e7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/comp/Deriving.hs
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,16 @@ doSGeneric :: SymTab -> Id -> Position -> Id -> [Type] -> CFields -> Either EMsg
doSGeneric r packageid dpos i vs fs = mkGenericInstance r packageid dpos i vs False
[(i, Just [fn | CField {cf_name=fn} <- fs], [fty | CField {cf_type=fty} <- fs])]

-- Build an instance of Generic for a struct / data declaration,
-- along with any needed poly field wrapper structs and instances
-- Arguments:
-- r == the symbol table
-- packageid == the name of the package
-- dpos == the position of the struct / data declaration
-- i == the name of the struct / data type
-- vs == the type parameters to which the type is applied
-- isData == is the type a data declaration (vs. struct)
-- summands == a list of tuples (constructor name, field names if constructor has named fields, field types)
mkGenericInstance :: SymTab -> Id -> Position -> Id -> [Type] -> Bool -> [(Id, Maybe [Id], [CQType])] ->
Either EMsg [CDefn]
mkGenericInstance r packageid dpos i vs isData summands =
Expand Down

0 comments on commit 607b1e7

Please sign in to comment.