How do you export type-operators? Considering they can clash with normal operators, there must be a special syntax if it's possible.
Use a named export to export a type in TypeScript, e.g. export type Person = {} . The exported type can be imported by using a named import as import {Person} from './another-file' . You can have as many named exports as necessary in a single file.
Use named exports to export a function in TypeScript, e.g. export function sum() {} . The exported function can be imported by using a named import as import {sum} from './another-file' . You can use as many named exports as necessary in a single file.
Module exports are the instructions that tell Node. js which bits of code (functions, objects, strings, etc.) to export from a given file so that other files are allowed to access the exported code.
I found the answer in section 7.4.4 of the GHC User's Guide, which states:
There is now some potential ambiguity in import and export lists; for example if you write
import M( (+) )
do you mean the function(+)
or the type constructor(+)
? The default is the former, but with-XExplicitNamespaces
(which is implied by-XExplicitTypeOperators
) GHC allows you to specify the latter by preceding it with the keywordtype
, thus:import M( type (+) )
Although it doesn't seem like you actually need to specify -XExplicitNamespaces
, maybe -XExplicitTypeOperators
is a typo meant to be -XTypeOperators
. Some more empirical evidence for this:
★ → :set -XExplicitTypeOperators
Some flags have not been recognized: -XExplicitTypeOperators
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With