Git Product home page Git Product logo

tryfsharp's Introduction

The F# repository has moved

Please go to https://github.com/dotnet/fsharp/. All contributions to the F# compiler/library/tools now go there.

This repository is the old repository for alternative packagings of F#. See notes below for historical notes on these. The core logic of F# is made available as a library component called FSharp.Compiler.Service, and F# is open source, so an unlimited number of other packagings of F# are possible.

Archival: Details on the various Alternative Packagings

Archival: The FSharp.Compiler.Tools NuGet package

This repo is currently used to make the FSharp.Compiler.Tools NuGet package. This package includes the following for both .NET Core and .NET Framework/Mono:

  • the F# compiler fsc.exe
  • F# Interactive fsi.exe
  • build support,
  • a copy of FSharp.Core used to run the tools
  • related DLLs.

The NuGet packages are exactly the ones produced by AppVeyor CI, e.g. for version 4.1.2. They are pushed to https://nuget.org by someone with appropriate permissions.

The FSharp.Compiler.Tools NuGet package can be used if you wish to use the latest F# compiler on a computer without relying on the installed version of Visual Studio. Adding it via NuGet to a project will override the in-box compiler with the compiler from the NuGet package. Note: you will need to manually modify your project file once (see #676).

Archival: The fsharp Debian Linux Package

Usage: See http://fsharp.org/use/linux

apt-get install fsharp

See the mono packaging repo, which is a downstream variant of this repo, where this package is actually made.

  • There is a tag for each upstream source tag
  • There is a tag for each "debianized" package
  • Packaging metadata lives in debian/
  • install files are files installed to disk
  • cligacinstall are GAC-installed libraries
  • control is the manifest of packages
  • rules is the Makefile which handles build/install.

Jo Shields (@directhex) has done much of this work and says:

I tend to only update the published packages when a) the same update has already been pulled in on Mac by Jason, and either b) something breaks horribly in the existing version on a new Mono, or c) someone explicitly asks me to.

Linux package delivery is (now) based on packages built on our public Jenkins instance, and published automatically as a post-build step, based on two inputs - a Git repository in standard Debian git packaging format (which https://github.com/mono/linux-packaging-fsharp already is), and a tarball to consider as the canonical source of the next release (giving the same tarball in subsequent builds is how you indicate packaging-only changes such as alterations to metadata in debian/)

Alexander Köplinger has admin access to Jenkins, SSH access to the Jenkins and repository servers, and has taken care of things for me in my absence in the past (but isn't a Debian packaging expert, so would be trusting that metadata changes are solid)

Archival: F# packaging in Mono + macOS

F# is packaged as part of Mono on macOS. Jason Imison says:

We use a system called BockBuild that pushes versions of F# (sometimes with patches) out with Mono for macOS (F# is bundled with mono here, not a separate package).

You can see an example build script here (if you have access, ping me if not) https://github.com/xamarin/bockbuild/blob/2017-02/packages/fsharp.py. Unfortunately, you need to know the branch name here – 2017-02 is what is going to be released with VS for Mac aka Mono 4.9.x

We build fsharp/fsharp internally so that we’re not dependent on you pushing out fixes / bumping packages. Miguel de Icaza likes to ‘own’ the code that we ship precisely to stop these kind of emergency issues.

@cartermp says:

For future reference, dependencies and code for the F# editing and F# Interactive support in Visual Studio for Mac/Xamarin Studio is here

Archival: History

See https://fsharp.org/history

F# compiler sources as initially dropped are available from fsharppowerpack.codeplex.com.

On 4 April 2014, Microsoft Open Tech published the F# compiler sources at http://visualfsharp.codeplex.com and began accepting contributions to the F# compiler/library and tools.

In 2016 the http://visualfsharp.codeplex.com repo moved to GitHub at https://github.com/Microsoft/visualfsharp.

In 2019 the .NET Foundation and the F# community unified repositories at https://github.com/dotnet/fsharp.

tryfsharp's People

Contributors

alfonsogarciacaro avatar baronfel avatar cartermp avatar chadunit avatar dependabot[bot] avatar dsyme avatar et1975 avatar forki avatar games avatar krzysztof-cieslak avatar michal880 avatar ncave avatar nhowka avatar nmnobre avatar reedcopsey avatar vbfox avatar voronoipotato avatar xdadaveshaw avatar zaid-ajaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tryfsharp's Issues

Update to .NET 6?

Looks like TryFSharp uses some older version of F# (noticed by certain new .NET 6.0 methods not being available). Not sure what version, since the following snippet fails to run:

printfn "%A" System.Environment.Version  // throws error: FABLE: Cannot resolve System.Environment.get_Version

It should be noted that the context-sensitive help just works, it recognizes Environment.Version just fine and shows its members.

PS, System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription doesn't work either, since the Interop dll isn't available (afaict).

Can we have light theme?

Hi authors, some people prefer light theme and it's also consistent with the F# website. Can a switch be added to the UI? Thanks!

Array2D module cannot be initialised

The following code fails to compile with FABLE: Cannot resolve Microsoft.FSharp.Collections.Array2DModule.Initialize

let s = Array2D.init 3 3 (fun x y -> x + y)
printfn "%A" s

Fssnip integration

I'm looking at potentially adding integration with the fssnip website. The old silverlight tryfsharp website was capable of loading code from hyperlinks, i.e. using the uri

http://www.tryfsharp.org/Create?codeUrl=http://fssnip.net/raw/7XZ

would result in the particular snippet contents being loaded. Does the current website have such a capability? On quick inspection I see that you can load snippets using a base64 encoded value via the code parameter, but couldn't find anything similar to the above.

cc @tpetricek

not working on iPad chrome

hi there,

I am trying to open the website on iPad (yah, I am teaching my kid to learn fsharp on iPad :) ), but it show only available on desktop.

Just wondering if ok to support iPad? I think ipad is good enough to use it?

Thanks

The About section should include a link to Documentation for Try F#

  1. In particular, I'm looking for information about how Try F# persists changes.

From experiment, it appears to have persisted some of my changes, but not others.

  1. Also, what is the purpose of the GitHub token input and how do I use it?

  2. In case I accidentally delete stuff, maybe there could be a reset button to restore the original content.

  3. Maybe the last link in the F# Basics section should be a blank page for experimentation (with just something like module Prototyping; open System; printfn "Hello, world!").

Put a timeout on executions

The following code contains an infinite loop in it:

open System

type Ops = Add | Sub | Mul | Div | And | Or | Eor | Bic | Lsl | Lsr | Asr | Ror | Ldc of int
         | Dup | Drop | Swap | Over | Ld8 | St8 | Ld16 | St16 | Ld32 | St32 | Se8 | Se16
         | For of Exp | Next | If of Exp*Exp | Func of string*Exp | Ldl of string | Stl of string
and Exp = Ops list

type Sym = Var of int32 | Fun of Exp

let symbols = Map.empty

let isNumber (x:string) = fst (Int32.TryParse(x))


let getOps = function
    | "+" -> Add
    | "-" -> Sub
    | "*" -> Mul
    | "/" -> Div
    | "and" -> And
    | "or" -> Or
    | "eor" -> Eor
    | "bic" -> Bic
    | "lsl" -> Lsl
    | "lsr" -> Lsr
    | "asr" -> Asr
    | "ror" -> Ror
    | "dup" -> Dup
    | "drop" -> Drop
    | "swap" -> Swap
    | "over" -> Over
    | "ld8" -> Ld8
    | "st8" -> St8
    | "ld16" -> Ld16
    | "st16" -> St16
    | "ld32" -> Ld32
    | "st32" -> St32
    | "for" -> For []
    | "next" -> Next
    | x when isNumber x -> Ldc (int x)
    | x -> failwithf "Unknown word %A" x

let exec = function
    | (Add,x::y::xs) -> (x+y)::xs
    | (Sub,x::y::xs) -> (y-x)::xs
    | (Mul,x::y::xs) -> (x*y)::xs
    | (Div,x::y::xs) -> (y/x)::xs
    | (Ldc x,xs)     -> x::xs
    | (_,[]) -> failwith "Empty stack"
    | x      -> failwithf "Unknown Op %A" x

let infix = function
    | (Add,x::y::xs) -> ("("+x+" + "+y+")")::xs
    | (Sub,x::y::xs) -> ("("+y+" - "+x+")")::xs
    | (Mul,x::y::xs) -> ("("+x+" * "+y+")")::xs
    | (Div,x::y::xs) -> ("("+y+" / "+x+")")::xs
    | (Ldc x,xs)     -> (string x)::xs
    | (_,[]) -> failwith "Empty stack"
    | x      -> failwithf "Unknown Op %A" x

let run f = Array.fold (fun xs op -> f (op,xs)) []

//let source = "2 3 + 1 - 2 /"
let source = "1 4 for dup + next + -"
let code = source.Split() |> Array.filter ((<>)"") |> Array.map getOps

printfn "Source:  %A" source
printfn "Code:    %A" code

let rec combFor xs bb ys depth =
    match xs with
    | [] -> if bb <> [] then printfn "ERROR: bb not empty %A" bb
            (xs,[],List.rev (bb@ys))
    | Next::xs when depth = 0 -> printfn "ERROR: No For!"
                                 failwith ""
    | Next::xs when depth = 1 -> (xs,[],List.rev (bb@ys))//(xs,List.rev bb,ys)
    //| Next::xs when depth > 0 -> combFor xs bb ys (depth - 1)
    //| For [] :: xs -> combFor xs bb (For []::ys) (depth + 1)
    | For [] :: xs   -> let (xs,bb,ys) = combFor xs bb ys (depth + 1)
                        combFor xs [] (For bb :: ys) (depth + 1)
    | x::xs when depth > 0 -> combFor xs (x::bb) ys depth
    | x::xs -> combFor (x::xs) bb ys depth

let c = List.ofArray code
printfn "Code:    %A" c
let d = combFor c [] [] 0 
printfn "CFor:    %A" d

//printfn "Infix:   %A" (run infix code)
//let result = run exec code
//printfn "Result = %A" (List.rev result)

It's a lot, but this will run infinitely on a local machine as a console app.

In the browser, this will freeze the page until your browser eventually asks to quit. We should put a limit on execution time and stop executing code, then notify the user about that.

Please bump F# version

Build fails with Octokit path not found

I'm working on my own fork of tryFSharp for my personal site - fsharpnotes.net

I've updated the global.json to using .NET 6 and otherwise haven't done anything special. When I run

fake run build.fsx -t "WatchApp"

I get a path error that (by the eye, at least) should resolve. In fact there are multiple references to the path, which in and of itself is a bit odd. Can anyone weigh in on why this is happening? Is there something I missed along the way - beyond paket restore/build ? Thanks!

image

Please support a light UI theme

I'm what you'd consider as an old developer with astigmatism. The current dark theme is making it impossible for me to use TryFSharp. Support for a light theme would be great for people like me.

ToUniversalTime() is not working in online TryFSharp

Not sure whether or not this is a true bug or not, i.e. maybe it's caused by how date and time are dealt with in browsers, but it does lead to differences in how code works in local FSI vs online FSI.

Example code

open System

let x = DateTime.Now
let y = x.ToUniversalTime()
x.Equals y |> printfn "%A"   // should be false
x = y |> printfn "%A"        // should be false
printfn "%A" x               // should be X hours before/after UTC
printfn "%A" y               // should be UTC

Expected output

If you run this, it should output the following (which is what you'll see when running it locally in FSI, except that in UK the times may actually be equal, anywhere else they should be different):

false
false
2/18/2022 6:37:54 PM
2/18/2022 5:37:54 PM

Actual output on https://try.fsharp.org/

However, it outputs this, note specifically the differences in how the %A outputs the time (which may be due to system wide settings on the machine, so not that big a deal), and, most importantly, that ToUniversalTime() did not change the time to UTC, instead the time variable remained unchanged.

true
true
Fri Feb 18 2022 17:09:41 GMT+0100 (Central European Standard Time)
Fri Feb 18 2022 17:09:41 GMT+0100 (Central European Standard Time)

General dotnet tooling realignment 2023?

Upgrade to dotnet tool manifest for fake (and paket, if paket is needed), NET6+ (or NET8), Fake, Vite, ditch octokit and nuget for dotnet publish?

I tried to test build another branch now but doesn't seem possible atm, it seems this repo needs a general upgrade in tooling, maybe webpack could be ditched in favour of vite or perla (simpler to setup?) @AngelMunoz

https://github.com/AngelMunoz/Perla.

How are the two buttons that execute code different?

On the left-hand side, there are two buttons, an arrow and a cercle:

image

So far I have not been able to figure out how they are different. I initially assumed the arrow would just execute the code currently selected, and the circle would execute the whole script, but this does not seem to be the case.

In that frame:

  • Would it be possible to add tooltips on the buttons to clarify what they do?
  • Would it be possible to run only the selected code with the triangle? I find the ability to just edit-and-run small pieces of code in a script very helpful in exploring / understanding what is happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.