Hi!
The first warning is really easy to get rid of. I'm sending a patch that
does the job (*). The other ones requires some more work.
/Josef
(*) The code compiles but I haven't actually tested it since I'm having
problems compiling the libraries from the current cvs. So, be careful with
the code ;-)
On Sun, 28 May 2000, Sven Panne wrote:
> I know that those warnings below are longstanding buglets, but would
> it be possible to remove them before the release of 4.07? I had a
> medium-quick look at the desugarer/type checker, but with no real
> success.
>
> -------------------------------------------------
> module Foo where
> import Complex
>
> bar :: String -> Int
> bar "ab" = 1
> bar "c" = 2
> bar _ = 3
>
> baz :: Complex Float -> Int
> baz 0 = 11
> baz (_ :+ _) = 22
> -------------------------------------------------
> panne@jeanluc:~ > ghc -Wall -c Foo.hs
>
> Foo.hs:5: Pattern match(es) are overlapped in the definition of function
> `bar':
> bar "c" = ...
>
> Foo.hs:10: Pattern match(es) are overlapped in the definition of
> function `baz':
> baz (_ (:+) _) = ...
>
> Foo.hs:10: Pattern match(es) are non-exhaustive in the definition of
> function `baz':
> Patterns not matched: (#x) with (#x) `notElem` [0]
> -------------------------------------------------
>
> Cheers,
> Sven
> --
> Sven Panne Tel.: +49/89/2178-2235
> LMU, Institut fuer Informatik FAX : +49/89/2178-2211
> LFE Programmier- und Modellierungssprachen Oettingenstr. 67
> mailto:[EMAIL PROTECTED] D-80538 Muenchen
> http://www.informatik.uni-muenchen.de/~Sven.Panne
>
>
Index: DsUtils.lhs
===================================================================
RCS file: /cvs/fptools/ghc/compiler/deSugar/DsUtils.lhs,v
retrieving revision 1.44
diff -c -r1.44 DsUtils.lhs
*** DsUtils.lhs 2000/05/25 12:41:16 1.44
--- DsUtils.lhs 2000/05/31 15:12:01
***************
*** 91,101 ****
| lit_ty == floatTy = ConPat floatDataCon lit_ty [] [] [LitPat
(mk_float lit) floatPrimTy]
| lit_ty == doubleTy = ConPat doubleDataCon lit_ty [] [] [LitPat
(mk_double lit) doublePrimTy]
! -- Convert the literal pattern "" to the constructor pattern [].
! | null_str_lit lit = ConPat nilDataCon lit_ty [] [] []
! -- Similar special case for "x"
! | one_str_lit lit = ConPat consDataCon lit_ty [] []
! [mk_first_char_lit lit, ConPat nilDataCon lit_ty [] []
[]]
| otherwise = default_pat
--- 91,98 ----
| lit_ty == floatTy = ConPat floatDataCon lit_ty [] [] [LitPat
(mk_float lit) floatPrimTy]
| lit_ty == doubleTy = ConPat doubleDataCon lit_ty [] [] [LitPat
(mk_double lit) doublePrimTy]
! -- Convert literal patterns like "foo" to 'f':'o':'o':[]
! | str_lit lit = mk_list lit
| otherwise = default_pat
***************
*** 121,129 ****
null_str_lit (HsString s) = _NULL_ s
null_str_lit other_lit = False
! one_str_lit (HsString s) = _LENGTH_ s == (1::Int)
! one_str_lit other_lit = False
! mk_first_char_lit (HsString s) = ConPat charDataCon charTy [] [] [LitPat
(HsCharPrim (_HEAD_ s)) charPrimTy]
\end{code}
--- 118,131 ----
null_str_lit (HsString s) = _NULL_ s
null_str_lit other_lit = False
! str_lit (HsString s) = True
! str_lit _ = False
!
! mk_list (HsString s) = foldr
! (\c pat -> ConPat consDataCon lit_ty [] [] [mk_char_lit c,pat])
! (ConPat nilDataCon lit_ty [] [] []) (_UNPK_ s)
!
! mk_char_lit c = ConPat charDataCon charTy [] [] [LitPat (HsCharPrim
c) charPrimTy]
\end{code}