(no subject)

Hamilton Richards ham@cs.utexas.edu
Fri, 13 Sep 2002 14:39:28 -0500


At 12:12 PM -0700 9/13/02, Richard Barth wrote:
>I'm just learning Haskell with Hugs98. I can't understand why the 
>line defining "foo" is acceptable while the line defining "bar" 
>(only difference is the unary minus) generates the error message at 
>the end. If someone could explain this, or, better yet, tell me how 
>I can figure this out for myself. Thanks.
>
>
>
>data Entry = Ent {date :: String, amount :: Double}
>
>foo = [Ent "baz"  1.0]
>
>bar = [Ent "baz" -1.0]
>
>
>
>Type checking......
>
>ERROR "...test.hs":7 - Unresolved top-level overloading
>
>*** Binding             : bar
>
>*** Outstanding context : Fractional (Double -> Entry)

Recall that function application has a higher priority than all the 
operators --including unary (-).

--Ham
-- 
------------------------------------------------------------------
Hamilton Richards                Department of Computer Sciences
Senior Lecturer                  The University of Texas at Austin
512-471-9525                     1 University Station C0500
Taylor Hall 5.138                Austin, Texas 78712-1188
ham@cs.utexas.edu                hrichrds@swbell.net
------------------------------------------------------------------