Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (16 sloc) 480 Bytes
module Part2b where
-- data [] a = [] | a : [a] -- already in standard library
-- infixr 5 : -- already in standard library
empty = []
oneWord = "apple" : []
twoWords = "banana" : "cantaloupe" : []
mystery1 = "pear" : empty
mystery2 = "peach" : oneWord
mystery3 = "pineapple" : mystery3
-- mystery4 = 42 : "apple" : [] -- won't compile
dropOne :: [a] -> [a]
dropOne (first:rest) = rest
dropOne [] = []
justOne :: [a] -> [a]
justOne (a:_) = a:[]
justOne [] = []
Jump to Line
Something went wrong with that request. Please try again.