Phone to 90s telephone button press converter in Haskell. Get out your RAZRs kids.
This was one of the more interesting Challenges from the excellent Haskell Programming from First Principles by Christopher Allen and Julie Moronuki.
Taken from chapter 11, Algebraic Data Types, the challenge was to create custom datatypes and use them to convert a teenage cellphone conversation into its respective ButtonActions (Digit, Press).
As a lover of Haskell and former teenaged RAZR owner, I couldn't resist this challenge.
convoBreakDowner myPhone readMe
####Output:
[[[('*',1),('7',1)],[('4',2)],[('6',3)],[('6',2)],[('3',2)],[('0',2)],[('8',1)],[('6',3)],[('0',2)],[('9',5)],[('0',4)],[('7',4)],[('0',2)],[('8',1)],[('3',2)],[('5',3)],[('3',2)],[('7',1)],[('4',2)],[('6',3)],[('6',2)],[('3',2)],[('0',2)],[('2',2)],[('8',2)],[('8',1)],[('8',1)],[('6',3)],[('6',2)],[('0',2)],[('7',1)],[('7',3)],[('3',2)],[('7',4)],[('7',4)],[('0',2)],[('2',3)],[('6',3)],[('6',2)],[('8',3)],[('3',2)],[('7',3)],[('8',1)],[('3',2)],[('7',3)],[('0',2)],[('4',3)],[('6',2)],[('0',2)],[('*',1),('4',2)],[('2',1)],[('7',4)],[('5',2)],[('3',2)],[('5',3)],[('5',3)],[('#',1)],[('0',2)],[('*',1),('4',1)],[('3',2)],[('8',1)],[('0',2)],[('6',3)],[('8',2)],[('8',1)],[('0',2)],[('9',3)],[('6',3)],[('8',2)],[('7',3)],[('0',2)],[('*',1),('7',3)],[('*',1),('2',1)],[('*',1),('9',4)],[('*',1),('7',3)],[('7',4)],[('0',2)],[('5',2)],[('4',3)],[('3',1)],[('7',4)],[('#',1)]],[[('*',1),('8',1)],[('4',2)],[('4',3)],[('7',4)],[('0',2)],[('9',1)],[('2',1)],[('7',4)],[('0',2)],[('6',3)],[('6',2)],[('3',2)],[('0',2)],[('6',3)],[('3',3)],[('0',2)],[('8',1)],[('4',2)],[('3',2)],[('0',2)],[('6',1)],[('6',3)],[('7',3)],[('3',2)],[('0',2)],[('4',3)],[('6',2)],[('8',1)],[('3',2)],[('7',3)],[('3',2)],[('7',4)],[('8',1)],[('4',3)],[('6',2)],[('4',1)],[('0',2)],[('*',1),('2',3)],[('4',2)],[('2',1)],[('5',3)],[('5',3)],[('3',2)],[('6',2)],[('4',1)],[('3',2)],[('7',4)],[('0',2)],[('3',3)],[('7',3)],[('6',3)],[('6',1)],[('0',2)],[('8',1)],[('4',2)],[('3',2)],[('0',2)],[('3',2)],[('9',2)],[('2',3)],[('3',2)],[('5',3)],[('5',3)],[('3',2)],[('6',2)],[('8',1)],[('0',2)],[('*',1),('4',2)],[('2',1)],[('7',4)],[('5',2)],[('3',2)],[('5',3)],[('5',3)],[('0',2)],[('*',1),('7',1)],[('7',3)],[('6',3)],[('4',1)],[('7',3)],[('2',1)],[('6',1)],[('6',1)],[('4',3)],[('6',2)],[('4',1)],[('0',2)],[('3',3)],[('7',3)],[('6',3)],[('6',1)],[('0',2)],[('3',3)],[('4',3)],[('7',3)],[('7',4)],[('8',1)],[('0',2)],[('*',1),('7',1)],[('7',3)],[('4',3)],[('6',2)],[('2',3)],[('4',3)],[('7',1)],[('5',3)],[('3',2)],[('7',4)],[('0',2)],[('2',2)],[('9',3)],[('0',2)],[('*',1),('2',3)],[('4',2)],[('7',3)],[('4',3)],[('7',4)],[('8',1)],[('6',3)],[('7',1)],[('4',2)],[('3',2)],[('7',3)],[('0',2)],[('*',1),('2',1)],[('5',3)],[('5',3)],[('3',2)],[('6',2)],[('0',2)],[('2',1)],[('6',2)],[('3',1)],[('0',2)],[('*',1),('5',1)],[('8',2)],[('5',3)],[('4',3)],[('3',2)],[('0',2)],[('*',1),('6',1)],[('6',3)],[('7',3)],[('6',3)],[('6',2)],[('8',2)],[('5',2)],[('4',3)],[('#',1)]],[[('*',1),('8',1)],[('2',1)],[('5',2)],[('3',2)],[('6',2)],[('0',2)],[('3',3)],[('7',3)],[('6',3)],[('6',1)],[('0',2)],[('2',3)],[('4',2)],[('2',1)],[('7',1)],[('8',1)],[('3',2)],[('7',3)],[('0',2)],[('1',1)],[('1',1)],[('#',2)],[('0',2)],[('*',1),('2',1)],[('5',3)],[('4',1)],[('3',2)],[('2',2)],[('7',3)],[('2',1)],[('4',3)],[('2',3)],[('0',2)],[('*',1),('3',1)],[('2',1)],[('8',1)],[('2',1)],[('0',2)],[('*',1),('8',1)],[('9',3)],[('7',1)],[('3',2)],[('7',4)],[('#',2)],[('0',2)],[('8',1)],[('4',2)],[('3',2)],[('0',2)],[('2',3)],[('4',2)],[('2',1)],[('5',3)],[('5',3)],[('3',2)],[('6',2)],[('4',1)],[('3',2)],[('0',2)],[('9',1)],[('2',1)],[('7',4)],[('0',2)],[('8',1)],[('6',3)],[('0',2)],[('2',3)],[('7',3)],[('3',2)],[('2',1)],[('8',1)],[('3',2)],[('0',2)],[('2',3)],[('8',2)],[('7',4)],[('8',1)],[('6',3)],[('6',1)],[('0',2)],[('3',1)],[('2',1)],[('8',1)],[('2',1)],[('8',1)],[('9',3)],[('7',1)],[('3',2)],[('7',4)],[('0',2)],[('2',1)],[('6',2)],[('3',1)],[('0',2)],[('8',2)],[('7',4)],[('3',2)],[('0',2)],[('8',1)],[('4',2)],[('3',2)],[('6',1)],[('0',2)],[('8',1)],[('6',3)],[('0',2)],[('2',3)],[('6',3)],[('6',2)],[('8',3)],[('3',2)],[('7',3)],[('8',1)],[('0',2)],[('2',1)],[('0',2)],[('8',1)],[('3',2)],[('3',2)],[('6',2)],[('2',1)],[('4',1)],[('3',2)],[('0',2)],[('2',3)],[('3',2)],[('5',3)],[('5',3)],[('7',1)],[('4',2)],[('6',3)],[('6',2)],[('3',2)],[('0',2)],[('2',3)],[('6',3)],[('6',2)],[('8',3)],[('3',2)],[('7',3)],[('7',4)],[('2',1)],[('8',1)],[('4',3)],[('6',3)],[('6',2)],[('0',2)],[('4',3)],[('6',2)],[('8',1)],[('6',3)],[('0',2)],[('4',3)],[('8',1)],[('7',4)],[('0',2)],[('7',3)],[('3',2)],[('7',4)],[('7',1)],[('3',2)],[('2',3)],[('8',1)],[('4',3)],[('8',3)],[('3',2)],[('0',2)],[('*',1),('2',2)],[('8',2)],[('8',1)],[('8',1)],[('6',3)],[('6',2)],[('*',1),('2',1)],[('2',3)],[('8',1)],[('4',3)],[('6',3)],[('6',2)],[('7',4)],[('0',2)],[],[('*',1),('3',1)],[('4',3)],[('4',1)],[('4',3)],[('8',1)],[('#',2)],[('0',2)],[('*',1),('7',1)],[('7',3)],[('3',2)],[('7',4)],[('7',4)],[],[('#',1)]],[[('*',1),('2',1)],[('7',4)],[('0',2)],[('2',1)],[('0',2)],[('5',3)],[('6',3)],[('8',3)],[('3',2)],[('7',3)],[('0',2)],[('6',3)],[('3',3)],[('0',2)],[('*',1),('4',2)],[('2',1)],[('7',4)],[('5',2)],[('3',2)],[('5',3)],[('5',3)],[('0',2)],[('2',1)],[('6',2)],[('3',1)],[('0',2)],[('3',3)],[('6',3)],[('7',3)],[('6',1)],[('3',2)],[('7',3)],[('0',2)],[('8',1)],[('3',2)],[('3',2)],[('6',2)],[('2',1)],[('4',1)],[('3',2)],[('3',1)],[('0',2)],[('*',1),('7',3)],[('*',1),('2',1)],[('*',1),('9',4)],[('*',1),('7',3)],[('0',2)],[('6',3)],[('9',1)],[('6',2)],[('3',2)],[('7',3)],[('#',2)],[('0',2)],[('*',1),('4',3)],[('0',2)],[('2',3)],[('6',3)],[('8',2)],[('5',3)],[('3',1)],[('6',2)],[],[('8',1)],[('0',2)],[('7',3)],[('3',2)],[('7',4)],[('4',3)],[('7',4)],[('8',1)],[('0',2)],[('8',1)],[('4',2)],[('4',3)],[('7',4)],[('0',2)],[('2',3)],[('4',2)],[('2',1)],[('5',3)],[('5',3)],[('3',2)],[('6',2)],[('4',1)],[('3',2)],[('#',1)]]]