[Haskell-cafe] Problem about pattern matching.

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Wed Apr 28 04:49:53 EDT 2010


Hi, I have code as below. How come "case" version works wrong and
gives me "overlap" compiling warning? Thanks.
  if dayOfMonth == firstDayOfMonth
    then v day (x, y)
    else if dayOfMonth == lastDayOfMonth
      then not_ $ v day (x, y)
      else Mider day (x, y)

  case dayOfMonth of
    firstDayOfMonth -> v day (x, y)
    lastDay -> not_ $ v day (x, y)
    _ -> Mider day (x, y)
-- 
竹密岂妨流水过
山高哪阻野云飞


More information about the Haskell-Cafe mailing list