import { Index , List } from '../types' ; import { Maybe } from '@typed/maybe' ; import { curry2 } from '@typed/functions' ; import { slice } from '../slice' ; name export const splitAt = curry2 ( __splitAt ) ; export type SplitAt = { < A > ( index , list ) : [ List < A > , List < A > ] ; < A > ( index ) : ( list : List < A > ) => [ List < A > , List < A > ] ; } ; function __splitAt < A > ( index , list ) { return [ slice ( 0 , Maybe . of ( index ) , list ) , slice ( index , Maybe . of ( list . length ) , list ) ] ; }