
What does `show "asdf"` give you in ghci? What Lyndon showed you was that
this function is equivalent to `shows x s = show x ++ s`.
Have fun,
Shrivats
On Sep 24, 2013 5:09 PM, "yi lu"
On Tue, Sep 24, 2013 at 6:54 PM, Lyndon Maydwell
wrote: 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"
I don't know the meaning of this result.
On Tue, Sep 24, 2013 at 8:15 PM, yi lu
wrote: 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
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners