File: Tuples.k

package info (click to toggle)
kaya 0.2.0-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,012 kB
  • ctags: 1,307
  • sloc: cpp: 6,691; haskell: 4,833; sh: 2,868; yacc: 768; makefile: 700; perl: 87
file content (23 lines) | stat: -rw-r--r-- 837 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/** -*-C-*-ish
    Kaya standard library
    Copyright (C) 2004, 2005 Edwin Brady

    This file is distributed under the terms of the GNU Lesser General
    Public Licence. See COPYING for licence.
*/

module Tuples;

"Sugared as (a,b)"
public data Pair<a,b> = Pair(a fst, b snd);
"Sugared as (a,b,c)"
public data Triple<a,b,c> = Triple(a fst, b snd, c third);
"Sugared as (a,b,c,d)"
public data Tuple4<a,b,c,d> = Tuple4(a fst, b snd, c third, d fourth);
"Sugared as (a,b,c,d,e)"
public data Tuple5<a,b,c,d,e> = Tuple5(a fst, b snd, c third, d fourth, e fifth);
"Sugared as (a,b,c,d,e,f)"
public data Tuple6<a,b,c,d,e,f> = Tuple6(a fst, b snd, c third, d fourth, e fifth,
				  f sixth);
/* Do we need more than 6-tuples? To be honest, I think anything more
   than a pair is unlikely to have a use that isn't done better by an ADT. */