Note: This post is a summary of information paraphrased from an excellent blog post by Christian Sepulveda.
Create the app and download the necessary dependencies.
| import org.scalajs.dom._ | |
| import org.scalajs.dom.document._ | |
| import zio._ | |
| import org.scalajs.dom.raw._ | |
| import scala.scalajs.js | |
| import scala.scalajs.js.annotation._ | |
| import scala.language.postfixOps | |
| trait DomService: | |
| def implementation: UIO[DOMImplementation] |
| <pre>_SECTION_BEGIN; | |
| // Code Source: wisestocktrader | |
| SetChartOptions(0,chartShowArrows|chartShowDates); | |
| /*Body Colors*/ | |
| whiteBody=C>=O; | |
| blackBody=O>C; | |
| /*Body Size*/ |
| import React, { useState, useEffect } from "react"; | |
| import { Checkbox, Input, Row, Col, Slider } from "antd"; | |
| import ReactDOM from "react-dom"; | |
| import { v4 as uuidv4 } from "uuid"; | |
| const Component = ({ checked, text = "", id }) => { | |
| const [value, setValue] = useState(false); | |
| const [num, setNum] = useState(0); | |
| useEffect(() => { | |
| setValue(checked); |
| package in.boxs | |
| sealed trait Position | |
| case object Center extends Position | |
| case object Corner extends Position | |
| sealed trait Axis | |
| case object XAxis extends Axis | |
| case object YAxis extends Axis | |
| case object ZAxis extends Axis |
Create the app and download the necessary dependencies.
| {-# LANGUAGE ExistentialQuantification, GADTs #-} | |
| module Main where | |
| class SvgNode a where | |
| toSVG :: a -> String | |
| data SvgNodeObject where | |
| Pack :: SvgNode a => a -> SvgNodeObject | |
| • Couldn't match type ‘Circle’ with ‘Line’ | |
| Expected type: Tree Line | |
| Actual type: Tree Circle | |
| • In the expression: Node (Circle (20, 30) 50) [] | |
| In the second argument of ‘Node’, namely | |
| ‘[Node (Circle (20, 30) 50) []]’ | |
| In the expression: | |
| Node (Line (100, 100) (30, 60)) [Node (Circle (20, 30) 50) []] | |
| | | |
| 11 | sampleTree = Node (Line (100,100) (30,60)) [Node (Circle (20,30) 50) []] |
| use std::fmt::*; | |
| /// A struct that represents a single node in a list | |
| /// | |
| /// # State | |
| /// * `element` - The element of type T that is stored in the node | |
| /// * `next` - An optional value that points to the next element in the list | |
| #[derive(PartialEq, Debug)] | |
| pub struct Node<T: Debug> { | |
| pub element: T, |
| {- | |
| Zachary Weaver <[email protected]> | |
| JSONParser.hs | |
| Version 0.1.1 | |
| A simple example of parsing JSON with Parsec in haskell. Note that | |
| since the primary point of this excersize is demonstration, | |
| Text.Parsec.Token was avoided to expose more of the grammar. Also, | |
| complicated optimizations and shorcuts were avoided (mostly). |
| import Text.ParserCombinators.Parsec | |
| import Data.List | |
| type Args = [String] | |
| type Body = [String] | |
| type Label = String | |
| data JSONProp = JSONProp Label JSON deriving Show | |
| data JSON = JSONObject [JSONProp] | |
| | JSONNumber Double |