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 Safe a = Safe a | |
| data NotSafe = NotSafe | |
| data SafeList a b where | |
| Nil :: SafeList a NotSafe | |
| Cons :: a -> SafeList a b -> SafeList a (Safe b) | |
| safeHead :: SafeList a (Safe b) -> a | |
| safeHead (Cons x _) = x | |
| -- safeHead Nil = ??? |
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
| # A simple class in Python | |
| class car(): | |
| # The __init__ method | |
| def __init__(self, color): | |
| self.color = color | |
| # The color method | |
| def color(self): | |
| return self.color | |
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
| irb(main):001:0> "false" ? true : false | |
| (irb):1: warning: string literal in condition | |
| => true | |
| # no warning if string is not a literal |
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
| and _ False = False | |
| and False _ = False | |
| and _ _ = True | |
| -- inferred type: Bool -> Bool -> Bool | |
| -- underestimated parameter type: the function would also work called like this: | |
| and 42 False | |
| -- and return False; the type checker throws an error for this though. | |
| and' _ False = 0 |
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 T1 = Bernd | Uwe | |
| data T2 = Bernd | Flo |
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 Project = Project { | |
| projId :: String, | |
| projKind :: ProjectKind, | |
| projDescription :: String, | |
| projBudget :: Int, | |
| projTeam :: [Person] | |
| } | |
| all_members :: [Project] -> [Person] | |
| all_members projects = concat $ map projTeam projects |
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
| def nb_lines(width, text) | |
| text = "" if text.nil? | |
| cw = @CurrentFont['cw'] | |
| width = @w - @rMargin - @x if (width == 0) | |
| wmax = (width - 2 * @cMargin) * 1000 / @FontSize | |
| s = text.gsub("\r", '') | |
| nb = s.length | |
| nb -= 1 if nb > 0 && s[nb-1] == "\n" | |
| sep = -1 | |
| i, j, l = 0, 0, 0 |
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
| . | |
| ├── deps | |
| │ └── lager | |
| ├── disco | |
| │ ├── ebin | |
| │ └── src | |
| ├── launcher | |
| │ ├── ebin | |
| │ └── src | |
| ├── main.config |
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
| % documentation for rebar.config: https://github.com/basho/rebar/blob/master/rebar.config.sample | |
| {sub_dirs, ["launcher", "disco"]}. | |
| {erl_opts, [debug_info, fail_on_warning, parse_transform, lager_transform]}. | |
| {require_otp_vsn, "R14"}. | |
| {deps, | |
| [lager, |
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
| [ 19.863] | |
| X.Org X Server 1.12.0 | |
| Release Date: 2012-03-04 | |
| [ 19.863] X Protocol Version 11, Revision 0 | |
| [ 19.863] Build Operating System: Linux 3.2.9-1-ARCH i686 | |
| [ 19.863] Current Operating System: Linux t41 3.2.11-1-ARCH #1 SMP PREEMPT Thu Mar 15 09:16:03 UTC 2012 i686 | |
| [ 19.863] Kernel command line: root=/dev/disk/by-label/linux_root ro | |
| [ 19.863] Build Date: 05 March 2012 06:02:28AM | |
| [ 19.863] | |
| [ 19.863] Current version of pixman: 0.24.4 |