module Language.Brainfuck.Examples where

-- Example Programs
helloWorld, bottles, helloum, sort, toupper :: String
helloWorld :: String
helloWorld =
  String
">+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-]"forall a. [a] -> [a] -> [a]
++
  String
"<.#>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>++++++++["forall a. [a] -> [a] -> [a]
++
  String
"<++++>-]<+.[-]++++++++++."
-- works now, thanks to int-e for explaining the BF spec to me
bottles :: String
bottles =
  String
"99 Bottles of Beer in Urban Mueller's BrainF*** (The actual"forall a. [a] -> [a] -> [a]
++
  String
"name is impolite)"forall a. [a] -> [a] -> [a]
++
  String
""forall a. [a] -> [a] -> [a]
++
  String
"by Ben Olmstead"forall a. [a] -> [a] -> [a]
++
  String
""forall a. [a] -> [a] -> [a]
++
  String
"ANSI C interpreter available on the internet; due to"forall a. [a] -> [a] -> [a]
++
  String
"constraints in comments the address below needs to have the"forall a. [a] -> [a] -> [a]
++
  String
"stuff in parenthesis replaced with the appropriate symbol:"forall a. [a] -> [a] -> [a]
++
  String
""forall a. [a] -> [a] -> [a]
++
  String
"http://www(dot)cats(dash)eye(dot)com/cet/soft/lang/bf/"forall a. [a] -> [a] -> [a]
++
  String
""forall a. [a] -> [a] -> [a]
++
  String
"Believe it or not this language is indeed Turing complete!"forall a. [a] -> [a] -> [a]
++
  String
"Combines the speed of BASIC with the ease of INTERCAL and"forall a. [a] -> [a] -> [a]
++
  String
"the readability of an IOCCC entry!"forall a. [a] -> [a] -> [a]
++
  String
""forall a. [a] -> [a] -> [a]
++
  String
">+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>"forall a. [a] -> [a] -> [a]
++
  String
"[-]<<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<"forall a. [a] -> [a] -> [a]
++
  String
"-]<<-<-]+++++++++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<"forall a. [a] -> [a] -> [a]
++
  String
"[>>+>+<<<-]>>>[<<<+>>>-]>[<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<+++"forall a. [a] -> [a] -> [a]
++
  String
"+++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-"forall a. [a] -> [a] -> [a]
++
  String
"]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]<++.>+"forall a. [a] -> [a] -> [a]
++
  String
"++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>"forall a. [a] -> [a] -> [a]
++
  String
">>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<+++++++"forall a. [a] -> [a] -> [a]
++
  String
"+>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<------"forall a. [a] -> [a] -> [a]
++
  String
"---->-]<.>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++"forall a. [a] -> [a] -> [a]
++
  String
"++[<---------->-]<--.>+++++++++[<+++++++++>-]<--.-.>++++++++"forall a. [a] -> [a] -> [a]
++
  String
"[<---------->-]<++.>++++++++[<++++++++++>-]<++++.-----------"forall a. [a] -> [a] -> [a]
++
  String
"-.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-."forall a. [a] -> [a] -> [a]
++
  String
">++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<"forall a. [a] -> [a] -> [a]
++
  String
"-----.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>+++"forall a. [a] -> [a] -> [a]
++
  String
"+[<++++++>-]<--.>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<."forall a. [a] -> [a] -> [a]
++
  String
"><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++"forall a. [a] -> [a] -> [a]
++
  String
"++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++[<++"forall a. [a] -> [a] -> [a]
++
  String
"+++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++"forall a. [a] -> [a] -> [a]
++
  String
"+++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]<"forall a. [a] -> [a] -> [a]
++
  String
"-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++."forall a. [a] -> [a] -> [a]
++
  String
"------.>+++++++[<---------->-]<+.>++++++++[<++++++++++>-]<-."forall a. [a] -> [a] -> [a]
++
  String
"-.---------.>+++++++[<---------->-]<+.>+++++++[<++++++++++>-"forall a. [a] -> [a] -> [a]
++
  String
"]<--.+++++++++++.++++++++.---------.>++++++++[<---------->-]"forall a. [a] -> [a] -> [a]
++
  String
"<++.>+++++[<+++++++++++++>-]<.+++++++++++++.----------.>++++"forall a. [a] -> [a] -> [a]
++
  String
"+++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<----->"forall a. [a] -> [a] -> [a]
++
  String
"-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<"forall a. [a] -> [a] -> [a]
++
  String
"++++++++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++"forall a. [a] -> [a] -> [a]
++
  String
".>+++++[<+++++++++++++>-]<.>+++[<++++++>-]<-.---.++++++.----"forall a. [a] -> [a] -> [a]
++
  String
"---.----------.>++++++++[<----------->-]<+.---.[-]<<<->[-]>["forall a. [a] -> [a] -> [a]
++
  String
"-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<+++++++++<[>>>+<<[>+>[-]<<-]"forall a. [a] -> [a] -> [a]
++
  String
">[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-]>>+>[<[-]<"forall a. [a] -> [a] -> [a]
++
  String
"<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<"forall a. [a] -> [a] -> [a]
++
  String
"<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+"forall a. [a] -> [a] -> [a]
++
  String
"<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>"forall a. [a] -> [a] -> [a]
++
  String
"-]<.>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..---"forall a. [a] -> [a] -> [a]
++
  String
"-----.-------.>>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++"forall a. [a] -> [a] -> [a]
++
  String
".>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++[<+++++++++>-]<-"forall a. [a] -> [a] -> [a]
++
  String
"-.---------.>+++++++[<---------->-]<.>++++++[<+++++++++++>-]"forall a. [a] -> [a] -> [a]
++
  String
"<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++["forall a. [a] -> [a] -> [a]
++
  String
"<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++"forall a. [a] -> [a] -> [a]
++
  String
"++++++++>-]<++++.------------.---.>+++++++[<---------->-]<+."forall a. [a] -> [a] -> [a]
++
  String
">++++++++[<+++++++++++>-]<-.>++[<----------->-]<.+++++++++++"forall a. [a] -> [a] -> [a]
++
  String
"..>+++++++++[<---------->-]<-----.---.+++.---.[-]<<<]"forall a. [a] -> [a] -> [a]
++
  String
"@"
helloum :: String
helloum =
  String
"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.@"
-- can't figure this one out either...
sort :: String
sort =
  String
"Here is a Brainf*** program that bubblesorts its input and spits it out:"forall a. [a] -> [a] -> [a]
++
  String
">>>>>,+[>>>,+]<<<[<<<"forall a. [a] -> [a] -> [a]
++
  String
"[>>>[-<<<-<+>[>]>>]<<<[<]>>"forall a. [a] -> [a] -> [a]
++
  String
"[>>>+<<<-]<[>+>>>+<<<<-]"forall a. [a] -> [a] -> [a]
++
  String
"<<]>>>[-.[-]]>>>[>>>]<<<]"
toupper :: String
toupper =
  String
",----------[----------------------.,----------]"

{-
Example optimized programs:

++++[>++++++++<-]>[.+]

[(0,IncByteBy 4),  (1,SetIpTo 7),     (2,IncPtrBy 1),
 (3,IncByteBy 8),  (4,IncPtrBy (-1)), (5,IncByteBy (-1)),
 (6,SetIpTo (-1)), (7,IncPtrBy 1),    (8,SetIpTo 12),
 (9,OutputByte),   (10,IncByteBy 1),  (11,SetIpTo (-8)),
 (12,Halt)
]

[[]]

[(0,SetIpTo 4),
 (1,SetIpTo 3),
 (2,SetIpTo (-1)),
 (3,SetIpTo 0),
 (4,Halt)
]

-}