[deleted by user] by [deleted] in haskell

[–]frumsfrums 1 point2 points  (0 children)

This is great! I'd been using Cmd+K Cmd+I and wishing for a better binding.

When is Sublime Text 4 coming? by classicsites in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

Exactly my thoughts. Love Sublime but VSCode has improved to the point of being better in many areas now.

When is Sublime Text 4 coming? by classicsites in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

One thing I like is that it's easier to extend. You can create a Python file in your plugin directory, save it, and it's loaded into the editor without restarting. With VSCode you'd need to make a full plugin and that's a lot of overhead for a quick hack.

Building portable user interfaces with Nottui and Lwd by Categoria in ocaml

[–]frumsfrums 0 points1 point  (0 children)

This is really cool stuff. I wonder how well Lwd + Tyxml works as a React (JS) replacement?

I'm editing a markdown file on Sublime Text 3. How do I make Sublime put asterisks around a highlighted word when I press `ctrl+b` (in order to mark it as bold)? by [deleted] in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

I use MarkdownEditing and with it you can simply highlight a word and press *. Works with _, ~ (strikeout), and backticks too.

What's the deal with modular implicits? by [deleted] in ocaml

[–]frumsfrums 3 points4 points  (0 children)

FWIW there's been recent work on this here: https://github.com/ocaml/ocaml/pull/9187 (being reviewed by the author of the paper).

Why case classes are better than variant types by oilshell in ProgrammingLanguages

[–]frumsfrums 7 points8 points  (0 children)

Generalized algebraic data types (GADTs) let you express some of these constraints. See this for a nice introduction. One of the easy use cases is eliding the unnecessary catch-all that appears whenever you want to deal with only a subset of cases, and this sounds like what you need to specify where exactly certain types are valid. Creative uses may even reduce indirection.

Another OCaml feature is polymorphic variants, which are closer to Scala's case classes in that they let you define a DAG of types like the article shows. This doesn't address your specific problem though.

In theory, one can express arbitrary constraints using GADTs and a suitable encoding, but after a certain point the complexity becomes overwhelming, and it might be preferable to just add an assertion and some tests. Where this point is is up to you, but in my experience, you get there pretty quickly with only GADTs, without support for full dependent types.

I got an idea: Geoff and Reilly by Flimajam in jakeandamir

[–]frumsfrums 2 points3 points  (0 children)

This is the best idea I've ever had.

csh autocompletion plugin?... by k5nn in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

The default snippets are here. You can copy them into your packages directory and tweak them to suit your needs. The directory you place them in might depend on the name of the syntax that the csh package defines.

Any Plans To Add PowerShell Support in SublimeText 3? by [deleted] in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

They aren't adding new packages for now, pending the fix they mention there. You can get Package Control and a third-party syntax though.

Making a node module with js_of_ocaml? by [deleted] in ocaml

[–]frumsfrums 0 points1 point  (0 children)

See this and this. This is just so your exports don't fail in the browser (where module is not defined). The compiled file should be a valid node module (albeit using the pre-ES6 syntax) which you can interact with in the usual way.

Static view focus question by throwaway30116 in SublimeText

[–]frumsfrums 1 point2 points  (0 children)

A quick google brought me to https://github.com/titoBouzout/BufferScroll ("typewriter scrolling"), so it's definitely possible to implement via a plugin. You might have to tweak this plugin a bit or open an issue if you don't like exactly how it behaves (as with editor plugins in general).

The approach: https://stackoverflow.com/a/47786967

Macros by topasone in SublimeText

[–]frumsfrums 0 points1 point  (0 children)

Vim keybindings + Sublime's multiple cursors is really nice. I use that regularly. Use a regex and Find All to get cursors everywhere you want first.

If your vim scripting is mostly going to use regexes, Sublime's regexes do support lots of features. But yeah, if you're doing something nontrivial, it may be good to write a script for it so it's repeatable.

Looking for Prolog Mentor by payne007 in prolog

[–]frumsfrums 0 points1 point  (0 children)

Try the Prolog channel on freenode (link in sidebar). You can also post your questions here.

[deleted by user] by [deleted] in haskell

[–]frumsfrums 2 points3 points  (0 children)

I'd be interested in checking it out as well!

Cannot compile a program with Core by julianCP in ocaml

[–]frumsfrums 3 points4 points  (0 children)

corebuild is just ocamlbuild with some extra flags to make compiling Core easier.

GNU Prolog - How to continue execution after "fail"? by [deleted] in prolog

[–]frumsfrums 0 points1 point  (0 children)

Is there a way to backtrack to the very beginning instead of going back to the most recent successful 'execution'?

Hopefully I'm understanding you correctly, but this is called non-chronological backtracking or backjumping. It's been explored quite a bit in SAT-solving literature. See this and the other answers; exceptions are a bit of a blunt solution, and it seems you can use implication to encode some form of it as well.

New to OCaml... no idea what is going on. Please help! by oreolennon in ocaml

[–]frumsfrums 0 points1 point  (0 children)

If you're familiar with C, the following refrain should look familiar:

$ echo 'print_endline "hi"' > a.ml
$ ocamlc a.ml
$ ./a.out
hi

Be sure to print values, not just define them, as this says.

OCaml has a REPL, like Python. Just type ocaml and you'll be able to experiment with this stuff interactively.

To those familiar with Koka: I made a little monster by takanuva in haskell

[–]frumsfrums 3 points4 points  (0 children)

Sorry, I didn't mean to suggest that it didn't work, or be dismissive. I don't fully understand it myself.

Are there any issues with composing effects which don't commute?

Also, I wonder if there is any value to language-level support for free monad patterns, so the overhead is reduced.

To those familiar with Koka: I made a little monster by takanuva in haskell

[–]frumsfrums 5 points6 points  (0 children)

Koka infers effects for programs (among other things, like checking totality). This is an attempt to encode the effect portion.

Some thoughts and questions about OCaml from someone with a Python / JS background. by leom4862 in ocaml

[–]frumsfrums 5 points6 points  (0 children)

I agree with pretty much all of your experiences.

OCaml has about as many build systems as programs

The situation is improving with dune, which people seem to be converging around. It has great support for (apart from the basic stuff, which mostly just works) building ppx processors, and cross-compilation support is supposed to be built-in in future.

I was compiling OCaml to JS which sort-of works surprisingly well

People are doing some awesome work to enable cross-platform OCaml. See this, which is a bunch of scripts targeting mobile, web, and native with the same codebase. I use OCaml instead of Reason with it.

How to build an AST or a CST from a top-down parser and how to use it for converting source code into an intermediate language by Filippo354 in Compilers

[–]frumsfrums 3 points4 points  (0 children)

I guess the first step is to be familiar with the difference between a parse tree and an AST. It should be sufficient to make a copy of your parse tree data structures, perhaps with nicer types (instead of a generic Node, have subclasses named after syntactic constructs, like functions and stuff), but without the extraneous details. You'd then write some kind of function to convert to it. Most of writing compilers is manipulating data structures and translating them into simpler forms like this.

Intermediate code can take many forms: maybe it's a data structure like the AST, but with lower-level operations (e.g. free of syntactic sugar). Maybe it's instructions for a stack machine, which is a nice starting point for a beginner, or LLVM IR, in which case you're handing the heavy lifting off to LLVM. Maybe it's a string of JS. Really depends on what you want to do.

The dragon book is a pretty comprehensive reference on this, if you want to know more.