haskell - About ++ to concate things -


given following function signature:

concatthings :: (show a) => -> string -> string concatthings str2 = str2 ++ (show any) 

if run concatthings "there" "hi", result be: "hi\"there\"", want "hithere".

how can still "hithere" function signature?

you wrap string in new type , provide simple show instance it:

newtype partialstring = partialstring string  instance show partialstring     show partialstring str = str 

and pass in wrapped string concatthings function:

let pstr1 = partialstring str1 in concatthings pstr1 str2 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -