
Looks like it's a convenience for building up a compositions of "Show"s. ShowS is indeed a synonym for a function. The type of shows alone isn't enough to figure out how it behaves exactly, but testing it out in GHCi is telling:
[Prelude] λ :i ShowS type ShowS = String -> String -- Defined in `GHC.Show' [Prelude] λ :i shows shows :: Show a => a -> ShowS -- Defined in `GHC.Show' [Prelude] λ shows "asdf" "qwer" "\"asdf\"qwer"
On Tue, Sep 24, 2013 at 8:15 PM, yi lu
Prelude> :i ShowS type ShowS = String -> String -- Defined in `GHC.Show'
It is a type of a function? I cannot understand this type, and don't know how to create functions of this type.
And this function "shows"
Prelude> :i shows shows :: Show a => a -> ShowS -- Defined in `GHC.Show'
I don't know how this function works.
Yi
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners