[Haskell-cafe] Data creation pattern?

Steffen Schuldenzucker sschuldenzucker at uni-bonn.de
Thu May 13 14:24:58 EDT 2010


Stephen Tetley wrote:
> Hi Eugene
> Is something like this close to what you want:
> For example this builds an object with ordered strings...
> makeOrdered :: String -> String -> String -> Object
> makeOrdered a b c = let (s,t,u) = sort3 (a,b,c) in Object s t u
Or just:

makeOrdered a b c = let (s:t:u:_) = sort [a, b, c] in Object s t u

(no support code required)

More information about the Haskell-Cafe mailing list