import { right, left, chain } from 'fp-ts/Either'
import { flow } from 'fp-ts/lib/function'
// XXX refactor input.split
// split :: String -> Right([String, String]) Left(Error)
export const split = (input: any) => typeof input !== 'string'
? left('not string input')
: input.split(',').length !== 2
? left('not two arguments')
: input.split(',')[0].length === 0 || input.split(',')[1].length === 0
? left('no empty arguments')
: right(input.split(','))
import { right, left, chain } from 'fp-ts/Either'
import { flow } from 'fp-ts/lib/function'
// XXX refactor input.split
// split :: String -> Right([String, String]) Left(Error)
export const split = (input: any) => typeof input !== 'string'
? left('not string input')
: input.split(',').length !== 2
? left('not two arguments')
: input.split(',')[0].length === 0 || input.split(',')[1].length === 0
? left('no empty arguments')
: right(input.split(','))