- Don't use partial functions (head, read, tail, fromJust, fail (in IO), error, undefined ... )
- Functions are your friend, use lots of them and keep them small.
- Serialization errors are the most common error in our codebase. When you are creating a JSON, Binary or Serialize instance try and avoid the standard "generator" functions.
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
| const int sensor =0; | |
| const int power = 1; | |
| const int relay = 2; | |
| const int bigDelay = 6250; //ms | |
| const int smallDelay = 100; //ms | |
| const int loopDelay = 1000; //ms |
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
| import qualified System.Random as R | |
| import Control.Monad (replicateM) | |
| data Multiplier = FourTimes | TwoTimes | |
| deriving (Eq,Show) | |
| generateMultipliers :: IO [Multiplier] |
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
| data Foo = Foo { firstItem :: Int | |
| , secondItem :: Float} | |
| processFoos incomingFoos = do | |
| let foos = fmap firstItem incomingFoost | |
| return $ toJSON $ foos |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> | |
| <title>Business Canvas Template</title> | |
| <!-- Bootstrap --> |
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
| #!/usr/bin/env stack | |
| {- stack | |
| --resolver | |
| lts-6.4 | |
| --install-ghc | |
| runghc --package turtle | |
| -} |
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
| cabal install --only-dependencies --enable-prof --enable-library-profiling |
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
| constraints: Crypto ==4.2.5.1, | |
| HTTP ==4000.2.19, | |
| HUnit ==1.2.5.2, | |
| MissingH ==1.3.0.1, | |
| MonadRandom ==0.4, | |
| QuickCheck ==2.8.1, | |
| ReadArgs ==1.2.2, | |
| StateVar ==1.1.0.0, | |
| adjunctions ==4.2.1, | |
| aeson ==0.8.0.2, |
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
| {--| | |
| # Invoice and Spreadsheet template system for Kiosk | |
| # The system should: | |
| ##* Allow a template to be specified that has holes which can be filled | |
| in from a [TemplateTableStore + DataTemplateEntry] | |
| ## Primary goals |