Tutorial by Examples: ee

The <div> in this template grows to 50px and then 100px and then shrinks back to 20px when you click the button. Each state has an associated style described in the @Component metadata. The logic for whichever state is active can be managed in the component logic. In this case, the component...
Given data Empty a we have data Free Empty a = Pure a -- the Free constructor is impossible! which is isomorphic to data Identity a = Identity a
Given data Identity a = Identity a we have data Free Identity a = Pure a | Free (Identity (Free Identity a)) which is isomorphic to data Deferred a = Now a | Later (Deferred a) or equivalently (if you promise to evaluate the fst element first) (Nat, a), aka Writer...
Given data Maybe a = Just a | Nothing we have data Free Maybe a = Pure a | Free (Just (Free Maybe a)) | Free Nothing which is equivalent to data Hopes a = Confirmed a | Possible (Hopes a) | Failed or equivalently (if you promise to evalua...
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 Empty a we have data Cofree Empty a -- = a :< ... not possible!
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 Identity a = Identity a we have data Cofree Identity a = a :< Identity (Cofree Identity a) which is isomorphic to data Stream a = Stream a (Stream a)
Given data Maybe a = Just a | Nothing we have data Cofree Maybe a = a :< Just (Cofree Maybe a) | a :< Nothing which is isomorphic to data NonEmpty a = NECons a (NonEmpty a) | NESingle 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.
// plugin initialization $.fn.greenify = function() { // within the function you can use any of the jQuery methods // and `this` context refers to jQuery object this.css( "color", "green" ); }; // apply plugin $( "a" ).greenify();
Slightly counterintuitively (but also the only sane way to make it work), this: val dyn: Dynamic = ??? dyn.x(y) = z is equivalent to: dyn.selectDynamic("x").update(y, z) while dyn.x(y) is still dyn.applyDynamic("x")(y) It is important to be aware of this, or else...
When it comes to dealing with timing issue, it is tempting and easy to put a "quick" browser.sleep(<timeout_in_milliseconds>) and move on. The problem is, it would some day fail. There is no golden/generic rule on what sleep timeout to set and, hence, at some point due to network or...
'<div style="font-size:11pt">' || expression || '</div>'
The following example combines several of the techniques covered here. It puts a hyperlink in a custom formatted column which, when clicked, opens the sales order record associated with a row. The hyperlink is designed to open the record in a new window or tab when clicked, and to display a tooltip ...
Registering a custom post type does not mean it gets added to the main RSS feed automatically.You need to use request filter to add custom post types to main RSS feed. // Add 'books' custom post types on main RSS feed function add_book_post_types_to_rss($qv) { if (isset($qv['feed']) &&amp...

Page 41 of 54