PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/core/src/main/scala/scalaz/Alpha.scala

http://github.com/scalaz/scalaz
Scala | 124 lines | 89 code | 33 blank | 2 comment | 0 complexity | 4f3872e9aa2251d5b0406605918e7c99 MD5 | raw file
  1package scalaz
  2
  3/** An algebraic data type representing the characters 'a' to 'z' */
  4sealed abstract class Alpha extends Product with Serializable {
  5  val toChar: Char
  6
  7  def toUpperChar: Char = toChar.toUpper
  8}
  9
 10object Alpha extends AlphaInstances {
 11
 12  case object A extends Alpha {
 13    val toChar = 'a'
 14  }
 15
 16  case object B extends Alpha {
 17    val toChar = 'b'
 18  }
 19
 20  case object C extends Alpha {
 21    val toChar = 'c'
 22  }
 23
 24  case object D extends Alpha {
 25    val toChar = 'd'
 26  }
 27
 28  case object E extends Alpha {
 29    val toChar = 'e'
 30  }
 31
 32  case object F extends Alpha {
 33    val toChar = 'f'
 34  }
 35
 36  case object G extends Alpha {
 37    val toChar = 'g'
 38  }
 39
 40  case object H extends Alpha {
 41    val toChar = 'h'
 42  }
 43
 44  case object I extends Alpha {
 45    val toChar = 'i'
 46  }
 47
 48  case object J extends Alpha {
 49    val toChar = 'j'
 50  }
 51
 52  case object K extends Alpha {
 53    val toChar = 'k'
 54  }
 55
 56  case object L extends Alpha {
 57    val toChar = 'l'
 58  }
 59
 60  case object M extends Alpha {
 61    val toChar = 'm'
 62  }
 63
 64  case object N extends Alpha {
 65    val toChar = 'n'
 66  }
 67
 68  case object O extends Alpha {
 69    val toChar = 'o'
 70  }
 71
 72  case object P extends Alpha {
 73    val toChar = 'p'
 74  }
 75
 76  case object Q extends Alpha {
 77    val toChar = 'q'
 78  }
 79
 80  case object R extends Alpha {
 81    val toChar = 'r'
 82  }
 83
 84  case object S extends Alpha {
 85    val toChar = 's'
 86  }
 87
 88  case object T extends Alpha {
 89    val toChar = 't'
 90  }
 91
 92  case object U extends Alpha {
 93    val toChar = 'u'
 94  }
 95
 96  case object V extends Alpha {
 97    val toChar = 'v'
 98  }
 99
100  case object W extends Alpha {
101    val toChar = 'w'
102  }
103
104  case object X extends Alpha {
105    val toChar = 'x'
106  }
107
108  case object Y extends Alpha {
109    val toChar = 'y'
110  }
111
112  case object Z extends Alpha {
113    val toChar = 'z'
114  }
115
116  val alphas: IList[Alpha] = IList(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z)
117
118  implicit def ToCharFromAlpha(a: Alpha): Char = a.toChar
119
120}
121
122sealed abstract class AlphaInstances {
123  // TODO
124}