profile
viewpoint

hcarty/ezgzip 18

Very simple gzip library for OCaml

hcarty/ezrest 17

Easy REST requests using cohttp

hcarty/ezmysql 10

Simple wrapper over ocaml-mysql

hcarty/ezlogs-cli 8

Ready-to-eat logging configuration using Cmdliner and Logs

elastic/ocaml-yara 5

OCaml bindings to libyara

hcarty/indexmap 5

Generic indexed data for OCaml

hcarty/imagelib 4

Image processing library for OCaml (experimental fork of CamlImages)

hcarty/cobinio 2

mmap-like random access in a cooperative thread friendly way

hcarty/gtk-light 2

Light wrapper around lablgtk2

hcarty/bear 1

Bare essential additions to the OCaml stdlib

push eventhcarty/shatter

Hezekiah M. Carty

commit sha e1d0c41539d26ce8750c0545a3747aa892d8a8a1

Tony formatting tweak

view details

Hezekiah M. Carty

commit sha 05bb3c7d8722cebb08c31db3040f863cfdaf1c65

Run in fullscreen

view details

Hezekiah M. Carty

commit sha 9a5c54796f1081f69598bd83e64e9f14adac9dac

Bump to ocamltformat 0.19.0

view details

push time in 6 days

issue commentmicrosoft/pyright

Exhaustiveness checks for patten matching

Thanks - and thank you generally for your prompt responses to issues and feature requests on here. It's very appreciated!

hcarty

comment created time in 10 days

issue commentmicrosoft/pyright

Exhaustiveness checks for patten matching

Where is match useful in place of if in that case? If there is no way to have implicit exhaustiveness checks for match statements then I'm curious to know where they help versus using if with the same pattern.

hcarty

comment created time in 10 days

issue commentmicrosoft/pyright

Exhaustiveness checks for patten matching

If you want a static type checker enforce exhaustiveness within a match statement, I recommend using the same approach

That's fair. The issue I have with that approach is that it requires users to remember to add a catch-all case to every match. Stylistically I'd prefer to maintain code where non-exhaustive matches are made explicit and exhaustiveness is expected by default. That way, for example, I can't forget to update a match when the matched value evolves to include new cases.

hcarty

comment created time in 11 days

issue openedocaml/ocaml

Module naming consistency in stdlib

We are about to gain very useful new In_channel and Out_channel modules in the OCaml stdlib. Meanwhile, in the multicore branch, new modules like EffectHandlers and ThreadLocal are being added. These names for these new modules are split between Snake_case and CamelCase. I know that the multicore modules have not landed in stdlib yet! This seems worth considering early so, if possible, stdlib module naming can be internally consistent.

I noticed the inconsistency in case while reading through the latest multicore update notes on the discuss forum. After asking some of the developers focused on multicore it was suggested that I raise the question here on the OCaml issue tracker.

created time in 11 days

issue openedmicrosoft/pyright

Exhaustiveness checks for patten matching

Is your feature request related to a problem? Please describe.

I would like to be able to be able to enable an error when a match does not cover all cases.

Describe the solution you'd like

I would like an option to generate an error when a match statement is not exhaustive. For example, this match statement would error with such an option enabled because the int case is not handled.

IntOrStr = int | str

def handle(x : IntOrStr) -> None:
    match x:
        case str(s):
            print(f"Handled {s}")

created time in 13 days

push eventhcarty/shatter

Hezekiah M. Carty

commit sha a6f3b4d88d4e0274aa1b938e70bdd41c7b04181e

Build improvements

view details

push time in 13 days

push eventorx/ocaml-orx

Hezekiah M. Carty

commit sha fb5290075d4a67620b8db07a5bb2ba2fdcdce1e4

Match upstream locale API changes

view details

push time in 15 days

PullRequestReviewEvent
PullRequestReviewEvent

push eventelastic/apm-agent-ocaml

Anurag Soni

commit sha 3e71d4d3344a62383663b1b61bf66b8d86979024

init

view details

Anurag Soni

commit sha c28316235e3519208a2d5c7fa9faffbfb7c436c8

Add types for span_id, trace_id and system_info

view details

Anurag Soni

commit sha 8c3866ebac4e92f9547f1c846df95c7b0d3d0b76

Add metadata types

view details

Anurag Soni

commit sha 150ed6c0be9369f30c58de6aba9e380f7ff89b1d

remove dune build info

view details

Anurag Soni

commit sha c336734e80a4973b23537d709f1cd15a70b57ba4

use mtime for durations

view details

Anurag Soni

commit sha aac85267c1f34a7b3dab353b2ac6d95e79d500b7

Update author/maintainer list

view details

Anurag Soni

commit sha 2114ccecc3a51eb45ecc844dd8ccb55b754e2b91

Merge pull request #1 from elastic/add-core-library-types Add core library types

view details

Anurag Soni

commit sha f0195e72d5d7d10f93b09694deb41cfb8a1da024

Use dune configurator to probe for system info

view details

Anurag Soni

commit sha c039cf44b1a22268e043909fb04f36943d776667

Merge pull request #2 from elastic/add-default-system-info Use dune configurator to probe for system info

view details

Hezekiah M. Carty

commit sha fad6180fa92df156bc6455d4b967fbc0726efe7f

Add missing ppx_yojson_conv dep

view details

Hezekiah M. Carty

commit sha 8045403ff2340fa575d1ee714fa3850be49a45e4

Merge pull request #3 from elastic/add-yojson-dep Add missing ppx_yojson_conv dep

view details

Hezekiah M. Carty

commit sha 2e02c619041823090956e796ac4c35577d710a6a

Update README with basic dev setup instructions We can make this into a proper user README as the interface becomes properly defined.

view details

Hezekiah M. Carty

commit sha dbcdc8630096a396b4eb7dbfb5d3225667c199d4

Use "Unknown" if system info is unavailable

view details

Hezekiah M. Carty

commit sha 9353a24a0147f0878dd206b9de89b17e93effd8a

Merge pull request #5 from elastic/dev-readme Update README with basic dev setup instructions

view details

Hezekiah M. Carty

commit sha f616f61b3f96d51cf9e96e2a16814ec3b1a3c90d

Use more efficient lazy value See https://ocaml.org/api/Lazy.html#1_Advanced for more details Co-authored-by: Anurag Soni <anurag@sonianurag.com>

view details

Hezekiah M. Carty

commit sha 1a431d689f6f649fbf04e91ea81cd27587d0a6e9

Merge pull request #4 from elastic/default-system-info Use "Unknown" if system info is unavailable

view details

Anurag Soni

commit sha d703ffb9f540effc3d3dc5a8133ee6d98eb13bcd

hide ptime from public api

view details

Hezekiah M. Carty

commit sha 3cd20b935b12168624e2c580d87fe72b523fda2a

Merge pull request #7 from elastic/hide-ptime-from-public-api hide ptime from public api

view details

Anurag Soni

commit sha 9a38042e5334226e8b036824571f687c7b3bd3ba

Add more metadata types (#8) * Add type for cloud information * Add service and user types

view details

Hezekiah M. Carty

commit sha 002efb4caa0d5aa98928b5c8019d73c343e5442d

Spans and transactions basics (#9) * Add Id.*.yojson_of_t * Add basic span and transaction types * use hex encoded ids when transmitting over the wire Co-authored-by: Anurag Soni <anurag@sonianurag.com>

view details

push time in 23 days

delete branch hcarty/orx

delete branch : basic-vscode-support

delete time in a month

startedCraigFe/field_repr

started time in a month

startedgodotengine/godot-headers

started time in a month

push eventhcarty/orx

Hezekiah M. Carty

commit sha 41b10dcda64658a71b2b494bf9dfc5a995842245

Add vscode tasks for profile and release builds Also a task to build debug, profile and release in sequence

view details

push time in a month

PR opened orx/orx

Add basic setup and build tasks for VS Code

This adds two tasks to VS Code:

  • Setup orx
  • Build orx (debug)

It's only been tested on macOS so far. I should be able to test Linux and Windows in the next few days. I wanted to push this out so that it's readily accessible and testable in case anyone else wants to give it a try!

+62 -0

0 comment

1 changed file

pr created time in a month

create barnchhcarty/orx

branch : basic-vscode-support

created branch time in a month

push eventelastic/ocaml-yara

Anurag Soni

commit sha 8310fb330f8c03579ee0a5b618dacc5a567f7324

Add a scan function that returns Rule.t

view details

Hezekiah M. Carty

commit sha adbb666099d08932c29569afc58c6126238961df

Merge pull request #5 from elastic/add-scan-rules Add a scan function that returns Rule.t

view details

push time in a month

PullRequestReviewEvent

pull request commentocaml/ocaml-lsp

Fix ppx process running

@rgrinberg Thanks! I don't have a 4.12 switch handy - I'm between 4.11 and 4.13 currently - but if you'd like another test I'm happy to setup a 4.12 switch to test against.

rgrinberg

comment created time in a month

startedmichal-z/zig-gamedev

started time in a month

issue commentocaml/ocaml-lsp

PPX won't work after Ocamlformat-rpc starts

Thank you for reporting this @keigoi! I installed ocamlformat-rpc recently on my machine and ppx handling broke in my vscode setup. I'd made several other changes and missed the connection between the two events.

opam remove ocamlformat-rpc and a restart of the language server - not sure if the restart was strictly required - fixed the issue for me.

keigoi

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentelastic/ocaml-yara

Read metadata from rules

 let finalize () = let finalize_exn () = Yr.unwrap @@ finalize ()  module Rule = struct-  type t = Yara_c.Yr_rule.t ptr--  let get_identifier rule =-    let rule = !@rule in-    getf rule Yara_c.Yr_rule.identifier+  type metadata =+    | Int of int64+    | Bool of bool+    | String of string++  type t = {+    identifier : string;+    namespace : string;+    metadata : (string * metadata) list;+  }++  let collect_metadata metas =+    let q = Queue.create () in+    let ident meta = getf meta Yara_c.Yr_meta.identifier in+    let rec loop metas =+      if not (is_null metas) then (+        let meta = !@metas in+        let flags = getf meta Yara_c.Yr_meta.flags in+        let last_in_rule = flags = Yara_c.Constants.meta_flags_last_in_rule in+        let ident = ident meta in+        match getf meta Yara_c.Yr_meta.type_ with+        | Yara_c.Meta_type.Integer ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add (ident, Int v) q;+          if not last_in_rule then loop (metas +@ 1)+        | String ->+          let v = getf meta Yara_c.Yr_meta.string in+          Queue.add (ident, String v) q;+          if not last_in_rule then loop (metas +@ 1)+        | Boolean ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add+            ( ident,+              Bool+                ( if v > 0L then+                  true+                else+                  false+                )+            )+            q;+          if not last_in_rule then loop (metas +@ 1)+        | Unknown _ -> loop (metas +@ 1)

Another option would be to remove the Unknown variant and raise when an unknown value is found, since that indicates our bindings are out of sync with the library.

anuragsoni

comment created time in a month

Pull request review commentelastic/ocaml-yara

Read metadata from rules

 let finalize () = let finalize_exn () = Yr.unwrap @@ finalize ()  module Rule = struct-  type t = Yara_c.Yr_rule.t ptr--  let get_identifier rule =-    let rule = !@rule in-    getf rule Yara_c.Yr_rule.identifier+  type metadata =+    | Int of int64+    | Bool of bool+    | String of string++  type t = {+    identifier : string;+    namespace : string;+    metadata : (string * metadata) list;+  }++  let collect_metadata metas =+    let q = Queue.create () in+    let ident meta = getf meta Yara_c.Yr_meta.identifier in+    let rec loop metas =+      if not (is_null metas) then (+        let meta = !@metas in+        let flags = getf meta Yara_c.Yr_meta.flags in+        let last_in_rule = flags = Yara_c.Constants.meta_flags_last_in_rule in+        let ident = ident meta in+        match getf meta Yara_c.Yr_meta.type_ with+        | Yara_c.Meta_type.Integer ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add (ident, Int v) q;+          if not last_in_rule then loop (metas +@ 1)+        | String ->+          let v = getf meta Yara_c.Yr_meta.string in+          Queue.add (ident, String v) q;+          if not last_in_rule then loop (metas +@ 1)+        | Boolean ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add+            ( ident,+              Bool+                ( if v > 0L then+                  true+                else+                  false+                )+            )+            q;+          if not last_in_rule then loop (metas +@ 1)+        | Unknown _ -> loop (metas +@ 1)+      )+    in+    loop metas;+    List.of_seq (Queue.to_seq q) -  let get_namespace rule =-    let rule = !@rule in+  let from_ptr ptr =+    let rule = !@ptr in     let ns = !@(getf rule Yara_c.Yr_rule.namespace) in

I think both of those are true. But a check against the pointers to make sure they're not null and raising an exception if they are seems like a worthwhile addition in case this assumption breaks in some future libyara version. No need to change the return type since, if we are wrong, it's the library code that needs to be fixed rather than the user's code.

anuragsoni

comment created time in a month

PullRequestReviewEvent

Pull request review commentelastic/ocaml-yara

Read metadata from rules

 let finalize () = let finalize_exn () = Yr.unwrap @@ finalize ()  module Rule = struct-  type t = Yara_c.Yr_rule.t ptr--  let get_identifier rule =-    let rule = !@rule in-    getf rule Yara_c.Yr_rule.identifier+  type metadata =+    | Int of int64+    | Bool of bool+    | String of string++  type t = {+    identifier : string;+    namespace : string;+    metadata : (string * metadata) list;+  }++  let collect_metadata metas =+    let q = Queue.create () in+    let ident meta = getf meta Yara_c.Yr_meta.identifier in+    let rec loop metas =+      if not (is_null metas) then (+        let meta = !@metas in+        let flags = getf meta Yara_c.Yr_meta.flags in+        let last_in_rule = flags = Yara_c.Constants.meta_flags_last_in_rule in+        let ident = ident meta in+        match getf meta Yara_c.Yr_meta.type_ with+        | Yara_c.Meta_type.Integer ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add (ident, Int v) q;+          if not last_in_rule then loop (metas +@ 1)+        | String ->+          let v = getf meta Yara_c.Yr_meta.string in+          Queue.add (ident, String v) q;+          if not last_in_rule then loop (metas +@ 1)+        | Boolean ->+          let v = getf meta Yara_c.Yr_meta.integer in+          Queue.add+            ( ident,+              Bool+                ( if v > 0L then+                  true+                else+                  false+                )+            )+            q;+          if not last_in_rule then loop (metas +@ 1)+        | Unknown _ -> loop (metas +@ 1)

We could add logging eventually, but I'm not sure if silently moving on or an exception is better here.

Since this is something that happens early, at rule-parsing time, I lean a bit toward raising an exception for now. That way it makes it immediately clear when there's a case we aren't handling.

anuragsoni

comment created time in a month

PullRequestReviewEvent
more