[
  {
    "path": ".gitignore",
    "content": "\\#*\n\\.#*\n\ndist\ncabal-dev/\n.cabal-sandbox\ncabal.sandbox.config\n*.ibc\n*.o\n*.a\n*.so\n*.dll\n*.dylib\n*.swp\n*~\n.DS_Store\n\n*.ibc\n*~\ndist\ncabal-dev\n*.o\n*.hi\n*.chi\n*.chs.h\n.virthualenv\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to 'Idris Koans'\n\n## Rules\n\n* Please aim to make commits self contained. Ideally one thing at a time.\n* Commit messages should have a brief (less than 73 characters) leading sentence. Together with a more detailed description where appropriate.\n\n## Dev Process\n\nFor developing the project, we aim to follow the following [Git Branching Model](http://nvie.com/posts/a-successful-git-branching-model).\nIn this model there are two main branches:\n\n* **master** Reflects the _current_ version of the tutorial inline with the _current_ version of Idris on Hackage.\n* **dev** Reflects the latest upstream and current state of the tutorial.\n\nAll pull requests that are for new additions to the project should go to **dev**\nAll pull requests that detail fixes to the tutorial that is: grammar, spelling, and coding mistakes should be submitted to **master**\n\nThis might sound complicated but in the long term it makes sense in terms of release management.\n"
  },
  {
    "path": "Koans/01-Arithmetic.idr",
    "content": "-- | Some simple arithmetic exercises.\nmodule Koans.Arithmetic\n\n-- | There were 32 B/W Episodes of Ivor the Engine, and 72 episodes\n-- were produced altogether. How many colour episodes were produced?\naddition : Bool\naddition = ?fillme1 + 32 == 72\n\n-- | B/W Episodes of Ivor the Engine were ten minutes long. If you\n-- were to watch all the episodes in one sitting how many minutes\n-- would it take?\nmultiplication : Bool\nmultiplication = ?fillme2 == 10 * 32\n\n-- | In what year did the Colourised version of Ivor the Engine first air?\nsubtraction : Bool     \nsubtraction = 1977 - ?fillme3 == 3\n\n-- | 26 B/W episodes of Ivor the Engine were discovered in a Pig shed\n-- in 2010. There were two seasons. How many episodes per season were\n-- there?\ndivision : Bool\ndivision = 26 / ?fillme4 == 2\n\n-- | There were 32 B/W episodes of ten minutes each, and 40 colour\n-- episodes of five minutes each. How many minutes of Ivor the Engine\n-- exist?\nparentheses : Int\nparentheses = ?fillme5\n\n-- --------------------------------------------------------------------- [ EOF ]\n"
  },
  {
    "path": "Koans/02-Equality.idr",
    "content": "-- | Exercises on Equality.\nmodule Koans.Equality\n\nequalityEq : Bool\nequalityEq = ?fillme1 == True\n\nequalityNeq : Bool\nequalityNeq = ?fillme2 /= 3\n\nequalityGeq : Bool\nequalityGeq = ?fillme3 >= 4\n\nequalityGtr : Bool\nequalityGtr = ?fillme4 > 4\n\nequalityLeq : Bool\nequalityLeq = ?fillme5 <= 5\n\nequalityLess : Bool\nequalityLess = ?fillme6 < 6\n\n-- --------------------------------------------------------------------- [ EOF ]\n"
  },
  {
    "path": "Koans/03-Boolean.idr",
    "content": "-- | Exercises on Boolean Relations.\nmodule Koans.Boolean\n\nlogicalAND : Bool\nlogicalAND = True && ?fillme1 == True\n\nlogicalOR : Bool\nlogicalOR = False || ?fillme2 == False\n\nlogicalNOT : Bool\nlogicalNOT = not ?fillme3 == False\n\nlogicalPredicate : Bool\nlogicalPredicate = not ( ?fillme4 && True) || (?fillme5 && False) == True\n\n-- --------------------------------------------------------------------- [ EOF ]\n"
  },
  {
    "path": "Koans/04-Ranges.idr",
    "content": "-- | Exercises on Ranges\nmodule Koans.Ranges\n\nrangeNums : Bool\nrangeNums = ?fillme1 == [1..13]\n\nstepUp : Bool\nstepUp = ?fillme2 == [3,6..20]\n\nstepDown : Bool\nstepDown = ?fillme3 == [20,17..1]\n\nstopMe : List Integer\nstopMe = ?fillme4 [1..]\n\n-- --------------------------------------------------------------------- [ EOF ]\n"
  },
  {
    "path": "Koans/05-Lists.idr",
    "content": "-- | Exercises on Lists\nmodule Koans.Lists\n\n-- | What is the type of this list.\nnats : ?someType\nnats = [0,1,2,3,4,5,6,7,9]\n\n-- | Reproduce the list [0,1,3,5,7,9,2,4,6,8] using the following functions.\nodds : List Int\nodds = [1,3,5,7,9]\n\nevens : List Int\nevens = [2,4,6,8]\n\nzero : Int\nzero = 0\n\nzeroOddsEvens : Bool\nzeroOddsEvens = ?fillme2 ++ odds ++ ?fillme3 == [0,1,3,5,7,9,2,4,6,8]\n\n-- | Complete the result of following functions.\n\nheadOList : Bool\nheadOList = ?fillme4 == Vect.head [5,4,3,2,1]\n\ntailOList : Bool\ntailOList = ?fillme5 == Vect.tail [0,1,2,3,4,5]\n\nlastOList : Bool\nlastOList = ?fillme6 == Vect.last [5,4,3,2,1]\n\ninitOList : Bool\ninitOList = ?fillme7 == Vect.init [1,2,3,4,5,6]\n\nlengthOList : Bool\nlengthOList = ?fillme8 == List.length [1,2,3,4,5]\n\nreverseTheList : Bool\nreverseTheList = ?fillme9 == List.reverse [1,2,3,4,5]\n\nfirst3 : Bool\nfirst3 = ?fillme10 == take 3 [1..10]\n\ndrop3 : Bool\ndrop3 = ?fillme11 == drop 3 [1..10]\n\ncountAllTheNumbers : Bool\ncountAllTheNumbers = ?fillme12 == sum [1..10]\n\ntimesAllTheNnumbers : Bool\ntimesAllTheNnumbers = ?fillme13 == product [1..10]\n\nelementOrNot : Bool\nelementOrNot = List.elem 4 ?fillme14 == True\n\n-- | Make this function true\nstopPete : Bool\nstopPete = ?fillme15 (repeat 3) == [3,3,3,3]\n\n-- --------------------------------------------------------------------- [ EOF ]\n"
  },
  {
    "path": "Koans/06-ListComprehensions.idr",
    "content": "module Koans.ListComprehensions\n\n-- | What is the result of the List Comprehension.\nlistCompZero : Bool\nlistCompZero = ?fillme1 == with Classes [ x + x | x <- [1..5] ]\n\n-- | Write a list comprehension that returns all the numbers divisible by four, doubled.\nmyFirstListComp : List Integer -> List Integer\nmyFirstListComp xs = ?fillme2\n\ncomputeList : Bool\ncomputeList = myFirstListComp [1..10] == [8,16]\n\n-- | Return all the numbers between 20 and 100 that are divisible by 9.\ndivisibleByNine : List Integer\ndivisibleByNine = ?fillme3\n\n-- | Using list comprehensions construct a function that turns a list of numbers into a list of strings.\n-- Odd numbers should be bang, Even numbers boom.\nboomBangs : List Integer -> List String\nboomBangs xs = ?fillme4\n               where\n                 transform : Integer -> String\n                 transform = ?fillme5\n\ndoBoomBangs : Bool\ndoBoomBangs = boomBangs [3,4,5,6,7] == [\"bang\", \"boom\", \"bang\", \"boom\", \"bang\"]\n\n\n"
  },
  {
    "path": "Koans/07-Tuples.idr",
    "content": "module Koans.Tuples\n\n-- Complete the following functions\n\nfirstPair : Bool\nfirstPair = ?fillme1 == fst (\"First\", \"Pair\")\n\nsecondPair : Bool\nsecondPair = ?fillme2 == snd (\"Second\", \"Pair\")\n\nwhatAmI : Vect 5 (Int, Bool)\nwhatAmI = ?fillme3\n\nws : Vect 5 String\nws = [\"zip\", \"a\", \"dee\", \"doo\", \"dah\"]\n\nis : Vect 5 Int\nis = ?fillme4\n\nmyFirstZip : Bool\nmyFirstZip = zip ws is == ?fillme5\n\nwhatIsMyResult : Bool\nwhatIsMyResult = ?fillme6 == Vect.zipWith (+) is is\n"
  },
  {
    "path": "Koans/08-HigherOrderFunctions.idr",
    "content": "module Koans.HigherOrderFunctions\n\n-- Complete these functions\n\n-- Maps are used to map a function to elements in a list.\nmyFirstMap : Bool\nmyFirstMap = ?fillme1 == map (2*) [1..4]\n\nmySecondMap : Bool\nmySecondMap = [1, 4, 9, 16, 25] == map ?fillme2 [1..5]\n\nmyThirdMap : Bool\nmyThirdMap = [25, 16, 9, 4, 1] == map ?fillme3 [1..5]\n\n-- Folds are used to combine elements in a list from start to finish using a function.\nmyFirstFold : Bool\nmyFirstFold = foldl (+) 0 [1..4] == ?fillme4\n\nmySecondFold : Bool\nmySecondFold = 5 == foldl ?fillme5 5 [1..4]\n\n\n-- Scans are like fold but you see the intermediate results, and then the result.\nmyFirstScan : Bool\nmyFirstScan = scanl (max) 5 [1,2,3,4] == ?fillme6\n\nmySecondScan : Bool\nmySecondScan = scanl ?fillme7 5 [1,2,10,1] == [5,5,5,10,10]\n\nmyThirdScan : Bool\nmyThirdScan = scanl (/) 64 [4,2,4] == ?fillme8\n\n\n-- TODO Add examples for scanr and foldr\n\n\n-- You can filter things as well.\n\nxs : List Int\nxs = [1,2,3,4,5,6,7,8,9,10]\n\nmyFirstFilter : Bool\nmyFirstFilter = filter (>5) xs == ?fillme15\n\nmySecondFilter : Bool\nmySecondFilter = filter ?fillme16 [10,20,30,40,50,60,70,80,90,100] == xs\n\n-- You can combine functions as well\n\nmyFirstCombi : Bool\nmyFirstCombi =  [\"bang\", \"boom\", \"bang\", \"boom\", \"bang\"] == map ?fillme17 (filter ?fillme18 xs)\n"
  },
  {
    "path": "Koans/Misc.idr",
    "content": "module Misc\n\nsmallOdds : List Integer\nsmallOdds = [x | x <- [1..20], Builtins.mod x 2 == 0 ]\n\ngreeter : String -> String\ngreeter whom = \"Hello to \" ++ whom\n\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2013, Idris Hackers\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this\n  list of conditions and the following disclaimer in the documentation and/or\n  other materials provided with the distribution.\n\n* Neither the name of the {organization} nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "README.md",
    "content": "idris-koans\n===========\n\nKoans are small lessons on the path to enlightenment.\nPreviously, the _Koans_ method of learning a language has be used by both: [Clojure](http://clojurekoans.com/), [Clojurescript](http://clojurescriptkoans.com/), and [Ruby](http://rubykoans.com/).\nWith Ruby Koans being the initial Koans project.\nThe aim of the Idris Koans project is to provide an easy learning environment in which you can learn Idris, and Functional Programming (FP).\nInsight will be derived by encountering 'failing' code that requires fixing.\nBy fixing the code you will learn more about Idris and FP.\n\nWithin the `Koans` folder you will find the various lessons.\nEach lesson addresses various topics within FP, and also specific to Idris.\nEach lesson consists of a series of functions that when passed through the Idris compiler will either: fail to type check, or have the wrong behaviour.\nTo pass each lesson each function needs to be completed or fixed so that it type checks, or has deterministic behaviour.\n\nThe files should be attempted in the following order:\n\n1. 01-Arithmetic.idr\n1. 02-Equality.idr\n1. 03-Boolean.idr\n1. 04-Ranges.idr\n1. 05-Lists.idr\n1. 06-ListComprehensions.idr\n\nIdris Koans is in early development and so the list of Koans and method of interaction is primitive.\nIf you would like to contribute please feel free to do so.\nHowever, please read [CONTRIBUTING.md] first.\nWe advised the best way to attempt each Koan is to edit the Koan file in your favourite editor, and compile each Koan in the terminal using the Idris compiler.\nIn future a more interactive environment may be planned.\nEither a CLI/REPL environment _a la_ [Clojure Koans](http://clojurekoans.com/), or Web Based _a la_ [Clojurescript Koans](http://clojurescriptkoans.com/) may be added.\n\nThe latest stable release of Idris can easily be installed using cabal:\n\n    $ cabal update; cabal install idris\n\nAlthough you can also install Idris from source.\n\nFor editing Idris there is support for both the [Emacs](https://github.com/idris-hackers/idris-mode) and [Vim](https://github.com/idris-hackers/idris-vim) editors.\n\nMore information concerning Idris can be found online from:\n\n* [idris-lang](http://www.idris-lang.org/)\n* [idris-tutorial](https://github.com/idris-hackers/idris-tutorial)\n* [idris-hackers](http://idris-hackers.github.io/)\n"
  }
]