This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- http://codingdojo.org/kata/FooBarQix/ | |
| {-# LANGUAGE OverloadedStrings #-} | |
| import Data.Text as T | |
| import qualified Data.Map.Strict as M | |
| import qualified Data.Char as C | |
| import qualified Data.List as L | |
| import Data.Maybe (catMaybes, fromMaybe) | |
| newtype Digit = D Text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update | |
| sudo apt-get install curl -y | |
| sudo apt-get install emacs25-nox -y | |
| sudo apt-get install git -y | |
| curl -sSL https://get.haskellstack.org/ | sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Implem04 | |
| open System | |
| type Age = int | |
| type FirstName = string | |
| type LastName = string | |
| type Person = | |
| { FirstName : FirstName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Implem03 | |
| open System | |
| type Age = int | |
| type FirstName = string | |
| type LastName = string | |
| type Person = | |
| { FirstName : FirstName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Implem02 | |
| open System | |
| type Age = int | |
| type FirstName = string | |
| type LastName = string | |
| type Person = | |
| { FirstName : FirstName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Implem01 | |
| open System | |
| //These are type aliases | |
| type Age = int | |
| type FirstName = string | |
| type LastName = string | |
| //This is a product type : Record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // In here we want to show informations about collaborators in some consulting organization. | |
| module BasicDemo | |
| //Basic import, useful to access "String" by example" | |
| open System | |
| //This is type alias | |
| type Age = int | |
| type FirstName = string | |
| type LastName = string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Linq; | |
| using System.Collections.Generic; | |
| public enum State { | |
| Invalid = 0, | |
| Ok = 1, | |
| Ignored = 2, | |
| NOk = 3, | |
| NN = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE NoImplicitPrelude #-} | |
| import Data.List (find) | |
| import Data.Monoid ((<>)) | |
| import Data.Either (Either(..)) | |
| import Data.Int (Int) | |
| import System.IO (IO,putStrLn) | |
| import Data.String (String) | |
| import Text.Show (show,Show) | |
| import Data.Maybe (maybe) | |
| import Data.Function ( (.), ($)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| race :: Int -> Int -> Int -> Maybe (Int, Int, Int) | |
| race v1 v2 g | |
| | v1 >= v2 = Nothing | |
| | otherwise = | |
| let ts = convertToSecondsThenFloorIt $ calculateTimeToCatchUpInHours v1 v2 g | |
| h = getHours ts | |
| m = getMinutes ts | |
| s = getSeconds ts | |
| in Just (h, m, s) | |
| where |