
22 Feb
2013
22 Feb
'13
7:07 p.m.
On Fri, Feb 22, 2013 at 10:43:32AM -0800, Bryce Verdier wrote:
Lets say I have a data type like so:
data IpAddress = IpAddress {$ o1 :: !Int,$ o2 :: !Int,$ o3 :: !Int,$ o4 :: !Int$ } deriving (Show)$
which you can create by doing: IpAddress 192 168 1 1
Is there a way to do the same thing with the input data in a list? Like: IpAddress [192,168,1,1]
or using some operator (or combination of operators):Like (I'm guessing (<????>) isn't in use): IpAddress <????> [192,168,1,1]
No, there isn't. But you can make a function ipAddress :: [Int] -> IpAddress ipAddress [a,b,c,d] = IpAddress a b c d -Brent