From 05b78c4083d04bfb420dec32ac493af49abbfc14 Mon Sep 17 00:00:00 2001 From: gcanti Date: Tue, 24 Oct 2023 18:56:14 +0200 Subject: [PATCH] add Import Statements section to Code Conventions --- docs/guides/code-conventions.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/guides/code-conventions.md b/docs/guides/code-conventions.md index 377865ee9e..9f39d7f863 100644 --- a/docs/guides/code-conventions.md +++ b/docs/guides/code-conventions.md @@ -21,6 +21,22 @@ nav_order: 1 +## Import Statements + +To properly import modules from `fp-ts`, you should use the following syntax: + +```ts +import ... from 'fp-ts/' +``` + +For instance, when importing the `Option` module, you can use the following code: + +```ts +import * as Option from 'fp-ts/Option' +``` + +This ensures that you're importing the required modules correctly. + ## Module structure In general a module containing the definition of a data structure has the following structure @@ -128,7 +144,7 @@ pipe( `K` means *K*leisli. A _Kleisli arrow_ is a function with the following signature ```ts -(a: A) => F +;(a: A) => F ``` where `F` is a type constructor. @@ -159,13 +175,13 @@ how can we parse `input`? We could lift the Kleisli arrow `parse`, i.e. transform a function ```ts -(s: string) => E.Either +;(s: string) => E.Either ``` into a function ```ts -(s: string) => IE.IOEither +;(s: string) => IE.IOEither ``` That's what `fromEitherK` is all about