Tutorial by Examples: er

Given data Writer w a = Writer w a we have data Free (Writer w) a = Pure a | Free (Writer w (Free (Writer w) a)) which is isomorphic to data ProgLog w a = Done a | After w (ProgLog w a) or, equivalently, (if you promise to evaluate the log first), Writer [w] a. ...
Given data Const c a = Const c we have data Free (Const c) a = Pure a | Free (Const c) which is isomorphic to data Either c a = Right a | Left c
Given data Reader x a = Reader (x -> a) we have data Free (Reader x) a = Pure a | Free (x -> Free (Reader x) a) which is isomorphic to data Demand x a = Satisfied a | Hungry (x -> Demand x a) or equivalently Stream x -> a with data Stream x = Stream x...
Given data Const c a = Const c we have data Cofree (Const c) a = a :< Const c which is isomorphic to data Writer c a = Writer c a
Given data Writer w a = Writer w a we have data Cofree (Writer w) a = a :< (w, Cofree (Writer w) a) which is equivalent to data Stream (w,a) = Stream (w,a) (Stream (w,a)) which can properly be written as WriterT w Stream with data WriterT w m a = WriterT (m (w,a))
Given data Either e a = Left e | Right a we have data Cofree (Either e) a = a :< Left e | a :< Right (Cofree (Either e) a) which is isomorphic to data Hospitable e a = Sorry_AllIHaveIsThis_Here'sWhy a e | EatThis a (Hospitable e a) or, if yo...
Given data Reader x a = Reader (x -> a) we have data Cofree (Reader x) a = a :< (x -> Cofree (Reader x) a) which is isomorphic to data Plant x a = Plant a (x -> Plant x a) aka Moore machine.
Xcode have ability to run any script with hotkey. Here is example how to assign hotkey ⌘+⌥+⌃+⇧+T to open Terminal app in current project folder. Create bash script and save it in some folder #!/bin/bash # Project Name: $XcodeProject # Project Dir: $XcodeProjectPath # Workspace Dir: $X...
While developing, inserting the following line to your code: assert False, value will cause django to raise an AssertionError with the value supplied as an error message when this line is executed. If this occurs in a view, or in any code called from a view, and DEBUG=True is set, a full and de...
Debugging takes time and effort. Instead of chasing bugs with a debugger, consider spending more time on making your code better by: Write and run Tests. Python and Django have great builtin testing frameworks - that can be used to test your code much faster than manually with a debugger. Writ...
constexpr const size_t addressSize = sizeof(sockaddr_in); constexpr const uint16_t defaultPort = 80; // The port you want to use int serverSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); sockaddr_in serverAddress, clientAddress; memset(&serverAddress, 0, addressSize); serverAddress....
To display current version, we can use VERSION from @angular/core package. import { Component, VERSION } from '@angular/core'; @Component({ selector: 'my-app', template: `<h1>Hello {{name}}</h1> <h2>Current Version: {{ver}}</h2> `, }) export class AppCompone...
Nested if()...else statements take more execution time (they are slower) in comparison to an if()...else ladder because the nested if()...else statements check all the inner conditional statements once the outer conditional if() statement is satisfied, whereas the if()..else ladder will stop condit...
If you want to investigate why you are maxing out your DTUs, add other metrics to the performance graph to see which metric is dominiationg your DTU usage. In this example, the DTU usage is clearly dominiated by the CPU usage
Here's an example of a custom camera controller. This reads the position of the mouse within the client window, and then slides the camera around as if it were following the mouse on the window. index.html <html> <head> <title>Three.js Custom Mouse Camera Control Ex...
In the same way as in Open Terminal in current Xcode project folder example, you can add clear of derived data folder with hotkey. Create custom behavior (follow the steps in Open Terminal in current Xcode project folder). But use another script. Script text: #!/bin/bash rm -rf $HOME"/Lib...
Integer literals provide values that can be used where you need a byte, short, int, long or char instance. (This example focuses on the simple decimal forms. Other examples explain how to literals in octal, hexadecimal and binary, and the use of underscores to improve readability.) Ordinary integ...
<canvas id = "canvas" height='400' width='500'></canvas> var canvas = new fabric.Canvas(document.getElementById('canvas')); console.log(JSON.stringify(canvas)); // '{"objects":[],"background":""}' canvas.add(new fabric.Rect({ left: 10, ...
The reference to the outer class uses the class name and this public class OuterClass { public class InnerClass { public void method() { System.out.println("I can access my enclosing class: " + OuterClass.this); } } } You can access fields and ...
Kotlin has two types of string literals: Escaped string Raw string Escaped string handles special characters by escaping them. Escaping is done with a backslash. The following escape sequences are supported: \t, \b, \n, \r, \', \", \\ and \$. To encode any other character, use the Unicod...

Page 335 of 417