-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
294 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
title: Guarded methods using equality witnesses | ||
synopsis: Guarded methods allow constraints to be attached to the receiver | ||
(self) only for certain methods, so that these methods can only | ||
be called if the receiver satisfies these constraints (these guards). | ||
OCaml does not syntactically allow this type of method to be defined | ||
directly. In this note, we'll look at how to encode them using a | ||
type equality witness. | ||
date: 2022-05-29 | ||
authors: [xvw] | ||
link: | ||
url: https://xvw.lol/pages/oop-refl.html | ||
lang: fra | ||
tags: [ocaml, oop, refl, gadt] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
title: OCaml, modules and import schemes | ||
synopsis: In this article, we're going to look at how generalised openings | ||
can be used to reproduce a common practice in other languages, | ||
which I call, somewhat pompously, import strategies, | ||
date: 2023-10-31 | ||
authors: [xvw] | ||
link: | ||
url: https://xvw.lol/pages/modules-import.html | ||
lang: fra | ||
tags: [ocaml, module] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title: Effective ML Through Merlin's Destruct Command | ||
synopsis: This article presents the use of the destruct command in Merlin | ||
and OCaml-lsp to generate missing patterns, or to specify patterns in | ||
pattern matching. | ||
date: 2024-05-29 | ||
authors: [xvw] | ||
link: https://tarides.com/blog/2024-05-29-effective-ml-through-merlin-s-destruct-command/ | ||
tags: [ocaml, lsp, ide, emacs, vscode, vim, merlin] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
page_title: Blog | ||
description: A federated blog of Webring's member | ||
--- | ||
|
||
The **Federated Blog** allows [webring members](/) to showcase federated | ||
articles on this page from _time to time_. The list of articles is not | ||
calculated automatically (via RSS/Atom feeds) but is the result of **a manual | ||
addition**. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
let run (module R : Sigs.RESOLVER) chain = | ||
Yocaml.Action.write_static_file R.Target.blog | ||
(let open Yocaml.Task in | ||
R.track_common_dependencies | ||
>>> Yocaml.Pipeline.track_file R.Source.articles | ||
>>> Yocaml_yaml.Pipeline.read_file_with_metadata | ||
(module Model.Page) | ||
R.Source.blog | ||
>>> first @@ Model.Articles.index chain R.Source.articles | ||
>>> Yocaml_omd.content_to_html () | ||
>>> Yocaml_jingoo.Pipeline.as_template | ||
(module Model.Articles) | ||
(R.Source.template "blog.html") | ||
>>> Yocaml_jingoo.Pipeline.as_template | ||
(module Model.Articles) | ||
(R.Source.template "layout.html") | ||
>>> drop_first ()) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(** An action that builds the webring blog. *) | ||
|
||
val run : (module Sigs.RESOLVER) -> Model.Chain.t -> Yocaml.Action.t |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
open Model_util | ||
|
||
type t = { page : Page.t; articles : Article.t list } | ||
|
||
let from_page = Yocaml.Task.lift (fun (page, articles) -> { page; articles }) | ||
|
||
let fetch ?limit chain path = | ||
Yocaml.Task.from_effect (fun () -> | ||
let open Yocaml.Eff in | ||
let* files = | ||
read_directory ~on:`Source ~only:`Files | ||
~where:(Yocaml.Path.has_extension "yml") | ||
path | ||
in | ||
|
||
let+ articles = | ||
List.traverse | ||
(fun file -> | ||
Yocaml_yaml.Eff.read_file_as_metadata | ||
(module Article) | ||
~on:`Source file) | ||
files | ||
in | ||
limit | ||
|> Option.fold ~none:articles ~some:(fun limit -> | ||
articles |> Stdlib.List.filteri (fun i _ -> i > limit)) | ||
|> Stdlib.List.sort (fun a b -> Article.sort b a) | ||
|> Stdlib.List.filter (Article.authors_in_chain chain)) | ||
|
||
let index ?limit chain path = | ||
let open Yocaml.Task in | ||
lift (fun x -> (x, ())) >>> second (fetch ?limit chain path) >>> from_page | ||
|
||
let normalize { page; articles } = | ||
let open Yocaml.Data in | ||
Page.normalize page | ||
@ [ | ||
("articles", list_of (fun x -> record (Article.normalize x)) articles); | ||
("has_articles", has_list articles); | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(** Describes a federation page of external articles published by ring members. *) | ||
|
||
type t | ||
(** The type describing the federation. *) | ||
|
||
val index : ?limit:int -> Chain.t -> Yocaml.Path.t -> (Page.t, t) Yocaml.Task.t | ||
|
||
(** {1 Dealing as metadata} *) | ||
|
||
include Yocaml.Required.DATA_INJECTABLE with type t := t |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.