Skip to content

Commit 6a3f545

Browse files
committed
Improve haddocks for datatypes in Info.hs
1 parent 8dc0d12 commit 6a3f545

File tree

1 file changed

+15
-1
lines changed
  • cardano-wasm/src/Cardano/Wasm/Internal/Api

1 file changed

+15
-1
lines changed

cardano-wasm/src/Cardano/Wasm/Internal/Api/Info.hs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ instance Aeson.ToJSON MethodReturnTypeInfo where
3434
-- | Information about a single parameter of a method.
3535
data ParamInfo = ParamInfo
3636
{ paramName :: String
37+
-- ^ Name of the parameter.
3738
, paramType :: String
39+
-- ^ Type of the parameter (as a TypeScript type).
3840
, paramDoc :: String
41+
-- ^ Documentation for the parameter.
3942
}
4043
deriving (Show, Eq)
4144

@@ -51,11 +54,15 @@ instance Aeson.ToJSON ParamInfo where
5154
-- | Information about a single method of a virtual object.
5255
data MethodInfo = MethodInfo
5356
{ methodName :: String
57+
-- ^ Name of the method in the virtual object of the JS API (which should match the exported function).
5458
, methodDoc :: String
59+
-- ^ General documentation for the method.
5560
, methodParams :: [ParamInfo]
56-
-- ^ Names of parameters, excluding 'this'.
61+
-- ^ Info about parameters, excluding 'this'.
5762
, methodReturnType :: MethodReturnTypeInfo
63+
-- ^ Return type of the method.
5864
, methodReturnDoc :: String
65+
-- ^ Documentation for the return value of the method.
5966
}
6067
deriving (Show, Eq)
6168

@@ -73,8 +80,11 @@ instance Aeson.ToJSON MethodInfo where
7380
-- | Information about a virtual object and its methods.
7481
data VirtualObjectInfo = VirtualObjectInfo
7582
{ virtualObjectName :: String
83+
-- ^ Name of the virtual object.
7684
, virtualObjectDoc :: String
85+
-- ^ Documentation for the virtual object.
7786
, virtualObjectMethods :: [MethodInfo]
87+
-- ^ Information about the methods of the virtual object.
7888
}
7989
deriving (Show, Eq)
8090

@@ -90,9 +100,13 @@ instance Aeson.ToJSON VirtualObjectInfo where
90100
-- | Aggregate type for all API information.
91101
data ApiInfo = ApiInfo
92102
{ mainObject :: VirtualObjectInfo
103+
-- ^ Information about the main virtual object of the API, which serves as the entry point.
93104
, virtualObjects :: [VirtualObjectInfo]
105+
-- ^ Info about all other (non-main) virtual objects and their methods.
94106
, initialiseFunctionDoc :: String
107+
-- ^ Documentation for the initialise function of the API (which creates the main virtual object).
95108
, initialiseFunctionReturnDoc :: String
109+
-- ^ Documentation for the return value of the initialise function (which is the main virtual object).
96110
}
97111
deriving (Show, Eq)
98112

0 commit comments

Comments
 (0)