No title

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Foo where

import System.Random
import Control.Monad (liftM2)

randomList :: IO [Int]
randomList = randomRs (-10, 10) `fmap` newStdGen

pairs :: IO [(Int, Int)]
pairs = liftM2 zip randomList randomList

getNPairs n = take n `fmap` pairs

data Point x y= Point Int Int  deriving (Show)
data Bool3 = True3 | False3 | Unk3 deriving (Show)
data Maybe3 a= Just3 a | Unknown3 | Missing3 deriving (Show, Eq, Ord)

getPoint (x,y) = Just3 (Point x y)
-- maybePoint n= map getPoint (getNPairs n)

foo n = do ps <- getNPairs n
           let bar = map getPoint ps
           return bar