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 Text.Show.Functions | |
| unEntero :: Int | |
| unEntero = 5 | |
| unFlotante :: Float | |
| unFlotante = 3.14 | |
| autorDeElVisitante :: String | |
| autorDeElVisitante = "Stephen King" |
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 HoraDeLectura where | |
| import Text.Show.Functions | |
| ------------------------ | |
| type Libro = (String, String, Int) | |
| titulo :: Libro -> String | |
| titulo (nombre, _, _) = nombre |
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 HoraDeLectura where | |
| import Text.Show.Functions | |
| ------------------------ | |
| --type Libro = (String, String, Int) | |
| -- Record Syntax | |
| data Libro = UnLibro { |
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 Text.Show.Functions() | |
| import Data.List (genericLength) | |
| main :: IO () | |
| main = return () | |
| --data! | |
| -- Sin Record Syntax! | |
| data Libro' = UnLibro' String String Int deriving (Show, Eq) |
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 Text.Show.Functions() | |
| import Data.List (genericLength) | |
| main :: IO () | |
| main = return () | |
| --type alias! | |
| type Libro = (String, Autor, Int) | |
| elVisitante :: Libro |
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 MethodLogging | |
| def self.included(includer) | |
| call_trace = TracePoint.new(:call) do |tp| | |
| next unless tp.defined_class == includer | |
| binding = tp.binding | |
| parameters = tp.parameters.flat_map { |it| it[1..-1] }.map { |it| [it, binding.local_variable_get(it)] }.to_h | |
| puts "Called method #{tp.method_id} of class #{tp.defined_class} with parameters #{parameters}!" | |
| end |
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 MethodLogging | |
| def self.included(includer) | |
| includer.singleton_class.patch :new do |*args, hyper| | |
| object = hyper.(*args) | |
| LoggerProxy.new(object) | |
| end | |
| end | |
| end | |
| class LoggerProxy < BasicObject |
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 Data.Maybe (fromJust) | |
| import Data.List (find) | |
| data Date = Date { | |
| month :: Int, | |
| day :: Int | |
| } deriving (Eq, Ord, Show) | |
| data Sign = Sign { | |
| name :: String, |